You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem arises when plotting a time series with irregularly-spaced samples:
I created two random time series with equally-spaced timestamps. Asking pandas to show it within different subplots works fine and provides correct date ticks.
I randomly dropped some samples and showed the time series in another set of subplots. This time, the minor ticks appear at random positions.
importnumpyasnpimportpandasaspd# Create dataframetime=pd.date_range("2007-04", "2019-03", freq="M")
data=np.random.rand(len(time), 2)
df=pd.DataFrame(data=data, index=time)
# Show with equally-spaced samples (case 1)df.plot(subplots=True)
# Show with unevenly-spaced samples (case 2)df=df.sample(frac=0.8, random_state=200)
df.plot(subplots=True)
Case 1: evenly-sampled time series
Case 2: unevenly-sampled time series
I also tried to include the following lines without success.
The problem arises when plotting a time series with irregularly-spaced samples:
I created two random time series with equally-spaced timestamps. Asking pandas to show it within different subplots works fine and provides correct date ticks.
I randomly dropped some samples and showed the time series in another set of subplots. This time, the minor ticks appear at random positions.
Case 1: evenly-sampled time series
Case 2: unevenly-sampled time series
I also tried to include the following lines without success.
Notes
I am using
pandas 1.4.1
withmatplotlib 3.5.1
and latest macOS version.The text was updated successfully, but these errors were encountered: