-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
AutoDateFormatter shows too much precision #4808
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
This might be perfect for the upcoming v2.0 style-change release, but I On Tue, Jul 28, 2015 at 10:40 AM, Matthijs Kooijman <
|
Previously, the AutoDateFormatter would choose a format with second or microsecond precision, even when the ticks were significantly coarser than that. The resulting extra precision looks weird and can clutter the display (especially with the long microsecond display). This commit changes the default scale to format dictionary, which now works as follows: - Use microsecond precision when the ticks are less than a second apart - Use second precision when the ticks are seconds apart - Use minute precision when the ticks are minutes or hours apart - Use day-precision, month or year precision when the ticks are days or more apart (unchanged). Note that there is no point in displaying only the hour when the ticks are hours apart, since then it won't be immediately clear that a time is being displayed. Adding the (technically superfluous) :00 for the minutes should make it immediately obvious that a time is being displayed, which is why the minute precision should also be used when the ticks are hours apart. While updating the documentation for this change, it was also changed to use symbolic constants instead of hardcoded numbers. This should make it more clear what the intention is. Closes: matplotlib#4808
Thanks for your reply, I created a PR just now. |
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
Hi, Quite some time ago I was making a plot with dates, and tried to get the axis to format milliseconds. Would it be possible to add milliseconds to the formatter, or at least the choise of digits in the formatter. |
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
- Use ISO complient formats by default - aded extra level of scale (seconds) - add rcparams for all of these strings closes matplotlib#4808 closes matplotlib#4809 closes matplotlib#5086
When trying to plot some date-based values, I noticed that the default labels show too much precision. I was trying to plot some data points over a minutes to hours interval, and the default plot kept showing times using a micro-second precision. Given that the major ticks were minutes apart, this seems overkill to me (and the extra digits quickly clutter the display, making the labels overlap).
Diving into the code, it seems the default "scaled" member of the
AutoDateFormatter, which determines what formats to use when, can be
improved. Currently, it:
or more apart (these are fine, so I lumped them together).
I think it should be like this:
or more apart (unchanged).
Note that there is no point in displaying only the hour when the ticks
are hours apart, since then it won't be immediately clear that a time is
being displayed. Adding the (technically superfluous) :00 for the
minutes should prevent this, which is why the minute precision should
also be used when the ticks are hours apart.
The above would be implemented by the following change (documentation
not updated yet):
Does this sound reasonable?
The text was updated successfully, but these errors were encountered: