Skip to content

automatic xlim with datetime x-axis is not properly set with axhline #18963

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

Closed
ahuang11 opened this issue Nov 17, 2020 · 1 comment
Closed

automatic xlim with datetime x-axis is not properly set with axhline #18963

ahuang11 opened this issue Nov 17, 2020 · 1 comment

Comments

@ahuang11
Copy link

import matplotlib.pyplot as plt

ax = plt.axes()
ax.axhline(5)
plt.plot(pd.date_range('2020-01', '2020-01-03'), [10, 15, 20])
plt.tick_params(labelcolor='white')

image

I expect the start to be 2020-01, not 2000-01.

Without date times, it works as expected (start = 10):

ax = plt.axes()
ax.axhline(5)
plt.plot([10, 15, 20], [10, 15, 20])
plt.tick_params(labelcolor='white')

image

@ahuang11
Copy link
Author

Nevermind, duplicate of #7742

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant