For questions related to the formatting of the x-axis in a plot
Questions tagged [x-axis]
332 questions
9
votes
2 answers
How to specify time locator's start-ticking timestamp
All I want is quite straight forward, I just want the locator ticks to start at a specified timestamp:
peudo code: locator.set_start_ticking_at( datetime_dummy )
I have no luck finding anything so far.
Here is the portion of the code for this…

eliu
- 2,390
- 1
- 17
- 29
7
votes
3 answers
How to modify messy and overlapping date labels below x axis
df (Pandas DataFrame) has two columns: Date (as datetime64) and Amount (as float).
I plot the values from Amount column against time, using barplot:
sns.barplot(x="Date", y="Amount", data=df)
plt.show()
However, the date labels are a terrible mess…

KMFR
- 895
- 1
- 15
- 24
5
votes
1 answer
plot dataframe with datetime as index and only display hours, minutes, and seconds on x-axis in python
I am able to produce the following plot with this code:
df_day['Time'] = pd.to_datetime(df_day['Time'], format = '%H:%M:%S')
df_day = df_day.set_index('Time')
fig=plt.figure(dpi=900)
plt.title("TESTER Summary for Day %i " %y + "\n Average Chamber…

Joseph Kelsey
- 73
- 2
- 7
5
votes
2 answers
How to show specific intervals of tick labels while maintaining the ticks
I'm currently trying to plot a figure with a lot of ticks.
It has ticks for each value from 0 to 50 resulting in packed tick labels that are merged making the plot quite messy.
I made the ticks using
fig, ax =…

Cody Chung
- 629
- 1
- 6
- 15
5
votes
2 answers
Subplot Datetime X-Axis Ticks Not Working As Intended
I'm attempting to plot many plots, here's a sample of how the data is organized:
My intention is to build a series of subplots for either hours or days (say 7 days in a week, or 24 hours in a day) using google analytics data. My index are date-time…

mburke05
- 1,371
- 2
- 25
- 38
5
votes
2 answers
x-axis ticks dates formatting and locations
I've tried to duplicate plotted graphs originally created with flotr2 for pdf output with matplotlib. I must say that flotr is way easyer to use... but that aside - im currently stuck at trying to format the dates /times on x-axis to desired format,…

Odif Yltsaeb
- 5,575
- 12
- 49
- 80
4
votes
2 answers
How to get years from a time series when the plot is displaying time series of a monthly freq (Rbeast )
I´d like to extract years from a time series index (the underlying time series is of monthly frequency). The reason I want to do it is creating a yearly axis.
I am using a package Rbeast.
Here is my result for tsp(NDVI_Chobe001.ts)
[1] 2002.500…

LisaD
- 41
- 2
4
votes
3 answers
Why are bar chart x-axis ticks showing strange and wrong negative values?
Why is my X-axis ticks showing Negative values when the Xaxis values range from 43990 - 44003.
import matplotlib.pyplot as plt
x=[44000, 44001, 44002, 44003, 43990, 43991, 43992, 43993, 43994, 43995, 43996, 43997, 43998, 43999]
y=[8, 5, 3, 1, 1, 3,…

jithu83
- 539
- 6
- 11
4
votes
2 answers
How to set limit range
Why doesn't matplotlib.pyplot.xlim() method work in the below example?
import matplotlib.pyplot as plt
l = [0,0.2,0.4,0.6,0.8,1.0]
plt.plot(l,l)
plt.xlim = (-10,10)
plt.show()

Denis Kuzin
- 863
- 2
- 10
- 18
3
votes
0 answers
Recharts: using custom x-axis ticks with a
I've been trying to create a chart with recharts in react and I keep on getting the same issue with custom x-axis ticks rendering when using the component.
I have a chunk of data to display for 1 day: [{ date: '9:30', value: 1 }, { date:…

Anton Pochernikov
- 31
- 1
3
votes
1 answer
Control tick marks in ggforce::facet_row
I am trying to produce a histogram with y-axis for different subsets of the data.
I have been following the instructions from here:
How to automatically adjust the width of each facet for facet_wrap?
But I cannot seem to get the tick marks on the…

Rhett
- 51
- 3
3
votes
0 answers
how do I apply 'tight' layout to all subplots?
plt.axis('tight') applies only on the last axis. How do I apply it to all three axises on the figure?
The data source looks like this.
And the code is:
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as…

hope
- 85
- 1
- 7
3
votes
0 answers
How to exclude rangebreak data together with rangeselector?
I have set rangebreak to exclude trading hours.
But when i choose a button that looks at the past 1 day (which includes the hours excluded in the rangebreak), the plot suddenly shows the non-trading hours.
However when i choose past 2 days or more,…

leonardltk1
- 257
- 1
- 4
- 18
3
votes
2 answers
Plot on primary and secondary x and y axis with a reversed y axis
I have created this plot where I have "observed E. coli" on the the left side "y axis", "modelled E. coli" on the right side "y axis" and "dates" on the "x axis".
The code is this
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot…

Phil
- 88
- 8
3
votes
1 answer
Multiple x-axis label rows in ggplot
I want to create a two-level x-axis label for my plot. First showing months near the ticks and the year below. Here is my script:
Date <-…

okscientist
- 53
- 6