For questions related to the formatting of the x-axis in a plot
Questions tagged [x-axis]
332 questions
3
votes
1 answer
How to plot time on the x-axis of a scatter plot for every minute
Setting minute minor ticks for 1-second sampled data raises: OverflowError: int too big to convert
Consider this dataframe with a sample interval of 1 second that spans about 30 minutes:
import matplotlib.pyplot as plt
from matplotlib.dates import…

cfort
- 2,655
- 1
- 19
- 29
3
votes
3 answers
How to set the range of x-axis for a seaborn pointplot?
I created a pointplot() and I cannot change x-axis limit. Although my data only contains 9 months, I want to show all 12 on my axis.
fig,ax = plt.subplots(figsize=(12,4))
sns.pointplot(data=tr_df, x='Month', y='numOfTrips', hue='Year', ax=ax,…

Bn.F76
- 783
- 2
- 12
- 30
3
votes
1 answer
What kind of set_major_locator should I use?
I have a question regarding a plot feature when the X-Axis is a date.
Setting
I have a two time-series dt and x, where dt is a list of datetime.datetime values and x is a numpy array object.
dt =
[datetime.datetime(1996, 12, 3, 0, 0),
…

uday
- 6,453
- 13
- 56
- 94
2
votes
2 answers
How to shift a pcolor plot along the x axis
I'd like to shift a pcolor plot along the x direction. But I'm not sure how to do it, as it's not as simple as using plot with a vector that specifies the x values
With this code:
import matplotlib.pyplot as plt
import numpy as…

owl7
- 308
- 1
- 3
- 9
2
votes
1 answer
Is it possible to add another x axis to a plotly chart?
I have a plotly chart that looks like this:
Is there a way to make a second x axis that only has the years? What I mean is that I want two x axes: a 'sub-axis' that has the months (Sep, Nov, Jan , ...), and another one that has the years (2021,…

Cace
- 31
- 4
2
votes
2 answers
Plotting repeated x-axis ranges in matplotlib, plotly and networkx
I need to draw a networkx graph with x axis ranges are repeating, such as 0-100, 0-100,0-100 etc. Nodes are distributed along these x axis domains and there can be edges connecting the nodes between different domains. To make it easier to…

mrq
- 274
- 1
- 2
- 14
2
votes
1 answer
Neither order.terms or scale_x_discrete reorders terms in sjPlot's plot_model()
I'm trying to make some model plots using plot_model() function in the sjPlot package.
The default is to have the terms alphabetically, which isn't logical for my data (animal behavior in response to enrichments and in baselines).
The function…

AMMD
- 21
- 1
2
votes
1 answer
Chart js - Chart doesn't show when x axis has type 'time'
I'm working on Char.js version 3.9.1 and I have a chart which display data (y value) along the time (x value). Everything seems to be working fine.
However, when I add 'type' property to x axis in order to make the x scale to have daily unit, the…

Pawich S.
- 375
- 6
- 20
2
votes
0 answers
How to add Custom GlyphSeries to LineSeries in visx XYChart?
I have implemented a Visx XYChart component with LineSeries.
Codesandbox link here
Requirement:
I need to display a Glyph to indicate the start and end of the individual LinePath, and only if the LinePath starts or ends in between the start or end…

anoop chandran
- 1,460
- 5
- 23
- 42
2
votes
1 answer
R - Modify ggplot columns width by a specific variable and use such variable as a reference on the X-axis
I have a dataset where each rows corresponds to a country, while the other variables are:
quantity: average quantity per element in the country
elements: total number of elements in the country
The plot I would like to reproduce, is the same…

nd091680
- 585
- 4
- 15
2
votes
1 answer
Why did plt.hline() show an extended long X axis than number of dates in the data? - matplotlib
I'm trying to replicate a plot example but ran into an issue with the x axis and date range. When the plt.hlines() is included, the range goes back to 1970. When removed, the date range is correct. What could be causing the issue?
import yfinance as…

Data
- 57
- 1
- 5
2
votes
1 answer
Can I reverse xaxis in Aitoff projection supported by matplotlib? (It is not duplicate.)
I want to reverse my xaxis of my aitoff projection in my python script. Here is an example
import numpy as np
import matplotlib.pyplot as…

Kyle
- 80
- 4
2
votes
1 answer
Flutter: Syncfusion charts how to explicitly set number of x axis labels to show
I'm using this library to show charts in my app.
With my data, the x-axis is always a DateTime
All I want to do is explicitly set the x-axis labels to show and WHERE to show them if possible, e.g.
Show 2 or 4 labels evenly spaced, beginning (so…

Dave
- 5,283
- 7
- 44
- 66
2
votes
0 answers
2
votes
1 answer
R object not found when using scale_x_discrete or scale_x_continuous
hour_mark avg_intensity
0 2.1295503
1 1.4190782
2 1.0439443
3 0.4437299
4 0.6330472
5 4.9506438
6 7.7712137
7 10.7336198
8 14.6680988
9 15.3877551
10 17.6437029
11 16.9212513
12 19.8470716
13 18.7752443
14 …

LordPuggo
- 79
- 7