xaxis limits change when plotting time series of different resolution as secondary_y · Issue #3490 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@bmu

Description

@bmu

In [1]: N = 10000

In [2]: rng = pd.date_range('1/1/2000', periods=N, freq='min')

In [3]: ts = pd.Series(np.random.randn(N), index=rng)

In [4]: ax = ts.plot()

In [5]: ax.get_xlim() Out[5]: (15778080.0, 15788079.0)

In [6]: ts.resample('D').plot(style='ro', ax=ax) Out[6]: <matplotlib.axes.AxesSubplot at 0x4482c50>

In [7]: ax.get_xlim() Out[7]: (15778080.0, 15788079.0)

In [8]: ts.resample('D').plot(style='ro', secondary_y=True, ax=ax) Out[8]: <matplotlib.axes.AxesSubplot at 0x497e450>

In [9]: ax.get_xlim() Out[9]: (10957.0, 10963.0)

As the xlim changes, the original data is not visible any more.

Could be related to #2185