-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Create correct xlim for ts plot and update datetimelike tests #28021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@charlesdong1991 I copied your comment from #27993 (comment) into the original issue. Hope that's OK. Do you still have the actual code snippets, rather than the text? It'd be nice to have them around. I do agree that the "after your change" behavior looks correct. |
ahh, thanks for editing, I should have done more on description. @TomAugspurger what do you mean by actual code snippets? something like this? (this was basically copied from the actual tests from yrs = [3.5, 11]
xpl1 = xpl2 = [pd.Period("1988Q1").ordinal] * len(yrs)
rs1 = []
rs2 = []
for i, n in enumerate(yrs):
rng = pd.period_range("1987Q2", periods=int(n * 4), freq="Q")
ser = pd.Series(np.random.randn(len(rng)), rng)
_, ax = plt.subplots()
ser.plot(ax=ax)
xaxis = ax.get_xaxis()
rs1.append(xaxis.get_majorticklocs()[0])
(vmin, vmax) = ax.get_xlim()
ax.set_xlim(vmin + 0.9, vmax)
rs2.append(xaxis.get_majorticklocs()[0]) |
and PR for this test is coming! |
i am sincerely apologizing for this, I realize today when doing tests that my fix is improper/wrong in terms of timeseries plotting. I am still trying to find root cause, hope to correct it asap before new release. Sorry again for it. @TomAugspurger |
Hi, thanks for your comment, @arthurire However, I could not reproduce it in master, this looks fine to me. |
emm, unfortunately i have to take back my previous comment. Just found out that this works as expected in my development setup, but if I import pandas in other environments/places, then I could reproduce this issue. Looks weird. |
xref: #27993
The view limit for non-datetime plotting is solved. and behavior will be the same as 0.23.4

e.g.
HOWEVER, issue in datetime-like still exists:

The issue with datetime-like plotting, xlim will be changed, and the view limit is set to data limit, so there is no margin on xaxis. Plots are looking like:
The text was updated successfully, but these errors were encountered: