-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
plot_date: Set the default fmt to 'o' #2641
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
Conversation
👍 - I'm in favour of this change. |
This makes sense to me as well. It will need a changelog entry, however, since it is (of course) a change of default behavior. |
Good idea. |
I am still iffy on this. I understand that this is a compromise, and it |
The implementation could easily be changed to use None. I don't see that it matters either way. What am I missing? Also, do we really want to eliminate non-None kwargs? For plot_date, for example, I don't see any possible advantage to using None for the xdate and ydate kwargs. The advantage of None is that it facilitates using rcParams for defaults, correct? Do you want plot_date.xdate and plot_date.ydate rcParams? |
I don't see how this change (from 'bo' -> 'o') will cause more headaches than leaving the status quo. I think the main advantage |
Ok, it pays to actually look at a diff rather than working from memory. I forgot that the plot_date()'s fmt is currently non-None anyway, so this is actually a step in the right direction, and I would be really happy when the default for fmt can be None so that other behavior can be enabled by default such as marker cycling (which has been something I have tinkered with for a while, but have been stymied by non-None defaults). The reason why we want to avoid non-None default values is that it is impossible to distinguish between a user explicitly stating that they want that default value, or that they don't care. This is where the idea of using None to mean "do the default thing" came to being. Obviously, kwargs such as xdate and ydate don't make sense to have anything more than just default values, so having a None for those likely superfluous. Btw, the pyplot.py needs to be updated as well. |
I've now updated |
Sorry @mineo but this wont merge cleanly. Would you mind squashing your commits, then rebasing?
See http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html for details Then
Thanks! |
Different to just plot() plot_date() has a default plot format string which makes it necessary to *unset* the default one when drawing multiple sequences of dates in a figure to get a working color cycling. It also was not exactly clear that Axes.set_color_cycle was setting the color cycle for every plot command except for plot_date ones. It was of course possible to simply unset it after reading the documentation but that's not the path of least suprise. The default fmt of 'o' will keep the markers by default (which makes sense for dates) but allows color cycling to happen. This is related to issue matplotlib#2148
@pelson |
plot_date: Set the default fmt to 'o'
Merged. Thanks @mineo |
Different to just plot() plot_date() has a default plot format string
which makes it necessary to unset the default one when drawing
multiple sequences of dates in a figure to get a working color cycling.
It also was not exactly clear that Axes.set_color_cycle was setting the
color cycle for every plot command except for plot_date ones.
It was of course possible to simply unset it after reading the
documentation but that's not the path of least suprise.
The default fmt of 'o' will keep the markers by default (which makes
sense for dates) but allows color cycling to happen.
This is related to issue #2148
(Here ends the commit message)
I'm the one who asked the question on SO that's linked to in issue #2148 and I just had to give this a try with a pull request because I think the discussion on the ticket was really short. Imho, setting the default format to just 'o' which keeps the markers but allows color cycling to happen is a reasonable compromise.