For questions related to the formatting of the x-axis in a plot
Questions tagged [x-axis]
332 questions
1
vote
0 answers
Box plot with 2 variables, changing variables on the x axis
I have a boxplot that looks like this:
My x axis has 2 variables (0 and 1) which I want to rename "Low" and "High" respectively but I just can't seem to find the code for this.
This is the code I used for the boxplot: data$meansplit is the vector…

Winnie
- 11
- 2
1
vote
0 answers
How to structure dates on x-axis in R
I am a beginner with R. It took me the larger part of a day to not find a solution.
I need a 2D-scatterplot with dates on the x-axis. Here is what I have:
################## CSV file looks like…

falkho
- 11
- 2
1
vote
1 answer
R plotly x-axis use labels for display
Trying to use R Plotly to graph bar chart. I need the chart x-axis ordered by q_order but need to have the x-axis display the labels from data called title. How would I do this?
Data
Chart
Code
fig <- plot_ly(
data = ybq,
x = ~q_order,
y =…

newbie_146
- 127
- 1
- 9
1
vote
1 answer
how to add a second x-axis to a line chart in R
First is the data and the manipulations. How would I add a second y-axis to this. the desired would have 2018 under the first value (Dec), 2019 under the next 12, and then 2020 under the next 11. would this be something where I would use annotate.…

Tim Wilcox
- 1,275
- 2
- 19
- 43
1
vote
1 answer
Dates on -Axis showing as Jan 51 instead of Jan 20
First question here so if something isnt clear, I can clarify...
if I comment out the last three lines my chart looks ok - but the dates on X axis dont show up in the format I want (MMM-YY) and if I change to the below per other things I've read I…

elir1
- 25
- 5
1
vote
1 answer
How to have ggplot show a label for each and every tick mark
This may seem simple but the solutions that I have found have only made it more complex. Below is the reproducible code that I am using. A bit circuitous but that is part of the learning experience. The result before adding the scale x continuous…

Tim Wilcox
- 1,275
- 2
- 19
- 43
1
vote
1 answer
Fill area below curve and x-axis based on x-value in gnuplot
I want to fill the area between the curve and the x-axis from xrange 1950 (start of data) to 2020. I tried doing this with
plot [..] with filledcurves below x1=2020
but this produces a plot where the y-scale is messed up and looks just wrong.
I've…

andand
- 105
- 6
1
vote
2 answers
R ggplot2 bar plot
I've linked together some code to create my current graph. My only problem is that my labels on the x-axis are being printed on top of each other. Does anyone know a solution? Also, is there a way I could organize my x-axis labels from greatest to…

SJJ
- 53
- 5
1
vote
1 answer
Highstock: How can I format the xAxis crosshair label?
I try to format the xAxis crosshair label, but the default one always overlap the formatted one. In the example, how can I have only the RED label? Or in other words, how can we format this xAxis crosshair label with HighStock (the behaviour seems…

FrancoisG
- 33
- 5
1
vote
1 answer
Setting xlim() removes the xticks
I am trying to plot 3 lines in matplotlib but whenever I add the xlim([]) the line disappears.
Without xlim:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
df.iloc[3:6,5:].T.plot()
with…

Reut
- 1,555
- 4
- 23
- 55
1
vote
1 answer
seaborn is not working with set_xticklabels() as expected
I'm trying to change the rotation on of the x axis labels on a seaborn linechart. However when I run the below code I just get a large list as output and a graph without x labels:
sns.set(rc={'figure.figsize':(15,5)})
chart = sns.lineplot(y =…

Stephen
- 133
- 1
- 9
1
vote
2 answers
Set xlim of time series
I want to draw a plot in matplotlib that shows the temperature of August in 2016 and 2017. x-axis is time and y-axis is temparature. I try to stack 2 plots (one for 2016, one for 2017) on top of each other by sharing the x-axis that ranges from…

Huy Tran
- 1,770
- 3
- 21
- 41
1
vote
2 answers
How to change the limits of axes
I have plot where the x-axis starts from 0-100. I want to change it to 10-100. I would be grateful if someone could give any suggestion.

deepayan das
- 1,567
- 3
- 14
- 21
0
votes
0 answers
How to create time-based x axis from two separate columns
I have a data frame like this
Date/Time Unit Value Nest_1 ... Nest_3 Nest_4 Nest_5 Control
0 22.1.2023 9:43:01 1 21.102 ... 23.111 21.547 22.056 21.090
1 22.1.2023 9:58:01 2 21.602 ... 21.110 22.048 …

Fred Grenade
- 7
- 3
0
votes
1 answer
How to add stacked x-axis labels to stacked bar chart
Given the following code:
import numpy as np
from matplotlib import pyplot as plt
from itertools import groupby
import pandas as pd
percent_EVs = [0, 8, 21, 26, 37, 39, 41, 75, 95, 97]
percent_DVs = [100, 92, 79, 74, 63, 61, 59, 25, 5, 3]
num_buses…

tcokyasar
- 582
- 1
- 9
- 26