For questions related to the formatting of the x-axis in a plot
Questions tagged [x-axis]
332 questions
1
vote
1 answer
How to fix x-axis showing two values with multi-line plot using matplotlib
I am trying to make a line plot showing different categories of one column (type) in a dataframe over the years. I have managed to create the lines, but now my x-axis shows the date, plus one of the types and I don't seem to be able to get rid of…

EllaV
- 35
- 3
1
vote
0 answers
Setting x-axis limits for date range in ggplot2
I'm making a plot with date on the x-axis, and I'm trying to set limits for the first and last date values in my data frame and only show every 28th label. There are 195 entries with dates in the format "%m-%d-%Y" and the x-axis is illegible with…

Talia Levine
- 11
- 2
1
vote
0 answers
(dygraph)x-axis label generated only at the point with the value
I have a question about the dygraph. I want to have the x-axis label generated only at the point with the value. Is it possible?

장유신
- 11
- 1
1
vote
2 answers
X-axis label positioning
I made a facetted plotly histogram like so:
fig = px.histogram(df,
x = "x column",
color = "colour column",
facet_col = 'facet…

Tim Kirkwood
- 598
- 2
- 7
- 18
1
vote
1 answer
How to customize the reserved width for each level of a categorical variable on x-axis [ggplot2]
Now I use the following codes to make a figure:
library(tidyverse)
df_simu <- tibble(
Var1 = c("A", "B", "B", "B", "B", "C", "C", "C", "C"),
Var2 = c("P", "W", "X", "Y", "Z", "W", "X", "Y", "Z"),
value = c(5, 10, 6, 4.5, 3, 5, 5, 4,…

Haiyang Jin
- 33
- 5
1
vote
1 answer
Plotting a line graph in R with a reversed x axis
I am trying to plot a spectra in R with a revered x axis using matplot:
matplot(x = colnames(aaaLowCarbonAbsorbanceSpec),
y = t(aaaLowCarbonAbsorbanceSpec),
main = "Low Carbon Absorbance", type = 'l',
xlab = "Wavenumber / cm-1", ylab =…

owentwhite
- 11
- 2
1
vote
1 answer
ggplo2 sample size annotation: How do you place the sample size under the x-axis?
I tried with the "solutions" from other posts without success. So, I am trying to add to my ggplot2 barplot the sample size per group under the names at the x-axis. I am using the stat_n_text(), but it does not allow you to change the position…

Carmen O
- 43
- 4
1
vote
1 answer
How do I scale the x-axis with ggplot?
I used the dataset below to make a plot. However, I don't know how to scale the x-axis and make it look nice.
ggplot(data = ggplot_data, mapping = aes(x = Estimate, y = Phenotype, group = Estimate_type,color = Estimate_type))+
…

Daniel Guncay
- 11
- 1
1
vote
2 answers
Fix specific dates on x-axis ggplot
I want to plot the following specific dates on my x axis: "2022-04-21", "2022-05-20", "2022-05-23", "2022-05-27", "2022-05-30", "2022-06-03", "2022-06-07", "2022-06-10", "2022-06-13".
These dates need to be fixed on the axis, meaning that if I have…

Pepijn95
- 321
- 1
- 6
1
vote
0 answers
How to convert timedelta for plotly histogram?
I want to plot histograms for timedelta64 (example: Timedelta('0 days 00:00:44.749500')
But in both cases, ploty.histogram() does not recognize the correct time but rather displays values (e.g., 50T 60T (See image)).
How do I have to convert the…

Florida Man
- 2,021
- 3
- 25
- 43
1
vote
1 answer
How to use a greek symbol in grid.arrange()
I am using the grid.arrange() function in R to parse together multiple plots. My current code is structured as follows:
grid.arrange(
plot1,
plot2,
legend,
ncol = 3,
top = "Change in Score",
left = "Change in Score"
)
I am trying to change the left…

Lucia Wagner
- 45
- 3
1
vote
1 answer
Plot gets stuck at 30 on x-axis Xcos
So my plot gets stuck at 30 on x-axis. I changed refresh period, so it shows me more of that axis, but there's no plot after 30.

jupyter51
- 13
- 3
1
vote
2 answers
How to reverse the order of x-axis (numeric) which is also applied to the data point in a graph?
I'd like to ask how to reverse the order of x-axis and also the direction of graph?
cv<- rep(c("cv1","cv2"), each=5)
value<- c(50,40,30,20,10,45,38,26,22,17)
index<- rep(c(5,15,27,36,45), each=2)
dataA<- data.frame(cv, value, index)
and I generated…

Jin.w.Kim
- 599
- 1
- 4
- 15
1
vote
2 answers
How to reorder a numeric x-axis in ggplot2?
First time posting, so please forgive any errors I make.
I'm attempting to plot some monthly values over the course of a year, starting in July. . Here is some sample data:
x <- seq(1, 12, 1)
set.seed(2022)
y <- rnorm(n = 12)
df <- data.frame("x" =…

lionSpyre
- 13
- 2
1
vote
0 answers
Multiple line plotting in one graph - how to automatically adjust the x- and y-axis to find all graphs
Following from my previous question here
R: Select vector (numeric) from data frame, sample n=10 subsets of size i=5 and i= 10 within vector and calculate mean for each of these samples
I want to plot the distribution of the resulting 2 vectors. I…

eternity1
- 651
- 2
- 15
- 31