For questions related to the formatting of the x-axis in a plot
Questions tagged [x-axis]
332 questions
2
votes
1 answer
Boxplot how to set the xlim
I am trying to make a box plot with the following code
boxplot(depy ~ depx, outline = FALSE, ylim = c(-20,20))
which works fine
When I try to add a limit for the x-axis
boxplot(depy~depx,outline=FALSE,xlim=c(-10,10),ylim=c(-20,20))
I get…

user3910073
- 511
- 1
- 6
- 23
1
vote
1 answer
In R, how to combine date and number unit in x-axis?
I have one data as below.
dataA = data.frame(structure(list(Sampling_date = structure(c(1684368000, 1685318400,
1685923200, 1686528000, 1687737600, 1688256000, 1688774400, 1689552000,
…

Jin.w.Kim
- 599
- 1
- 4
- 15
1
vote
1 answer
change number of breaks and x-axis label based off another column
I have a dataframe with too many variables on the x-axis so I would like to introduce breaks in my x-axis labels and change those labels based on another column. I've found a solution here…

NosiMsomi
- 37
- 4
1
vote
2 answers
Remove space between bar plot with time series data that contains only few months per year
I am trying to make a bar plot in ggplot of time series data that only includes data for January, February, and March for each year (40+yrs). I want one bar per month for all the years in the dataset with the bars next to each other (no spaces). To…

FishyFishies
- 301
- 3
- 14
1
vote
1 answer
How to display all major and minor tick labels with log scale
I am trying to plot an xy-graph whose x-axis is logarithmic. I did that using this command:
import matplotlib as plt
plt.plot(X,Y)
plt.xscale('log')
The x-axis is logarithmic, but only values which are multiples of 10 are displayed in the graph,…

khashayar
- 11
- 3
1
vote
1 answer
sort numerical values with a character in between on r
I'm trying to plot a graph from the data frame below which has a column called "Week" where the year and week of the year are combined. I would like to use this column as my x-axis but when I plot the graph, the order is not correct.
library…

NosiMsomi
- 37
- 4
1
vote
1 answer
highcharts xAxis min not works in unvenly spaced xAxis data
in code i provided i have a data series column with unevenly spaced data,
and set min value for xAxis with 1658086242000, but after seeing chart i saw 2 value that is before my min point, why is that?!
my whole code:
const simpleData = [ [
…

shahrooz bazrafshan
- 545
- 4
- 17
1
vote
1 answer
Use .format() with StrMethodFormatter in Matplotlib?
This works:
for ax in fig.axes:
ax.xaxis.set_major_formatter(StrMethodFormatter("{x:,.3f}"))
This returns KeyError: 'x':
for ax in fig.axes:
ax.xaxis.set_major_formatter(StrMethodFormatter("{x:,.{}f}".format(3)))
I want to set the…

Programming_Learner_DK
- 1,509
- 4
- 23
- 49
1
vote
2 answers
How to avoid extra date ticks and labels on a bar chart
I try to learn matplotlib and stuck on some nuisance. I have these lines:
import os
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
current_dir = os.path.dirname(os.path.abspath(__file__))
csv_path =…

Gwinbleid
- 55
- 7
1
vote
2 answers
How to create a continuous geom_line across a facet boundaries in ggplot2 over the time series data?
I'm working on a ggplot code. I have a dataset AirPassenger in tsibble format and I want to create a facet grid plot with four line plots showing the observed data, trend, seasonal, and irregular components. I have managed to create the plot using…

Rony Golder
- 111
- 6
1
vote
1 answer
Incorrect timestamps are shown on the x-axis
I have the following bar plot being generated with the following code:
import matplotlib as mplt
from matplotlib import dates, pyplot
from matplotlib.transforms import ScaledTranslation
import numpy as np
import pandas as pd
ts =…

AGS
- 401
- 5
- 17
1
vote
1 answer
Setting xticks moves all bars to the left side of the figure
I'm trying to set the x-ticks labels for every 10 years. However, when the x-ticks range is set, all of the bars are compressed to the left side of the figure.
DataFrame Sample
Temperature Year
0 82 1900
1 52 1901
2 …

Sonny Parlin
- 931
- 2
- 13
- 28
1
vote
1 answer
Creating a two level x-axis that groups the first axis
I'm am trying to recreate a variant of this chart:
The main difference being that I am creating a bar chart with x-axis being date time (in 3 hour increments), and the bar being coloured based on another series called intensity (low - green, high -…

AGS
- 401
- 5
- 17
1
vote
1 answer
How to format the x-axis by hour increments
I'm working with a dataset that includes the bedtimes of participants for weekdays, weekends, and the entire week. The bedtimes are represented as strings in the "hh:mm" format. Here's a sample of the data:
Au cours de la semaine
En…

Marouane Freeman
- 13
- 3
1
vote
2 answers
How to reduce the number of tick labels on a bar plot
The following bar graph is too cluttered on the x axis.
Is there a manner in which I can increment my ticks? Instead of showing every tick between 18-55, it increments by 3 or 5 (or more) so it looks nicer? I noticed that when I ran a line plot, it…

conrito345
- 35
- 6