Skip to content
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

Update visualization.rst #27092

Closed
wants to merge 1 commit into from
Closed

Update visualization.rst #27092

wants to merge 1 commit into from

Conversation

niklassemmler
Copy link

closes #26293

Note added to the docs, warning users to be careful when adapting datetime indices generated by pandas.

@@ -1608,6 +1608,9 @@ available in matplotlib. Although this formatting does not provide the same
level of refinement you would get when plotting via pandas, it can be faster
when plotting a large number of points.

**Note**: The customization of datetime ticks in a timeseries plot can lead to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Small nits:

  • Could you use the .. note:: directive here
  • Use matplotlib directly for full customization of axis ticks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I think it'd be good to expand a bit when these problems can happen, and what kind of problems users can face. The note seems to generic to me to add much value to the readers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mroeschke Thanks, I changed the formatting. Let me know, if this works for you.

@datapythonista The issue occurred to me when changing the minor/major locator/formatter. The result was that the indices became obfuscated (see picture in #26293 ). TomAugspurger mentioned that this is caused by the complex tick structure in pandas. So, I would propose to either leave it as a general recommendation/note or bring someone in that has more knowledge of the structures than me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anyone really understands the tick formatting code in pandas right now.

To make this a bit more useful, perhaps something like

Pandas registers custom tick formatters for time series data. These may conflict with custom locators or formatters you apply after plotting. For complete control over the plot, use matplotlib directly, rather than :class:`DataFrame.plot`.

Looks like you have a linting error: https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=13617

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the text to Tom Augspurger's version. The syntax error is fixed.

@@ -1608,6 +1608,13 @@ available in matplotlib. Although this formatting does not provide the same
level of refinement you would get when plotting via pandas, it can be faster
when plotting a large number of points.

.. note::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very duplicative of the paragraph above. I would maybe slightly edit that paragraph rather than adding new.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paragraph above is about performance, this note is about correctness. I think it is a good idea to highlight the second, because it can surprise users (it surprised me). So I disagree with you, but then if this is important to you, you could propose an alternative.

@WillAyd
Copy link
Member

WillAyd commented Aug 26, 2019

@TomAugspurger any thoughts on this?

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Aug 26, 2019 via email

@datapythonista
Copy link
Member

I agree with Jeff and Tom, the note in this PR is just repeating what it's already in the docs. Closing this, and since the issue is still open, if someone has a better idea on how to help the users understand the problem with ticks, can open a new PR.

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

Successfully merging this pull request may close these issues.

Changes to major/minor locator on a DateTime index leads to messed up axis
6 participants