-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Cannot plot fully masked array against datetimes #11337
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
Here is the full traceback if it is needed:
|
The problem seems to be that a fully masked array is "plotted" around (0, 0) independent of the x values and this doesn't work with datetimes because they should always be larger than 1. I get the following value error in 2.2.2 that explains more. |
I think the problem is more that an artist without any visual representation is attempted to be drawn. I would say this tracks down to the question of why the two below codes give different xlimits:
In the second case, even though the artist has no extent on the axes, the axes limits are changed. I would argue that this shouldn't be the case - and if fixed, would also solve this issue here automagically. |
I believe that is consistent with my thoughts. plt.plot([]) sets axis around 0 and that does not work with a datetime x axis. I also saw that loglog with fully masked data worked and that the limits where not around zero in that case. |
I think @ImportanceOfBeingErnest diagnosed this right. The bug is someplace in the auto-scale logic for |
I just checked that the array was not completely masked with an if
statement before I plotted the data. If it was fully masked, it just didn't
plot the data and displayed a small graphic saying the data was fully
masked for that particular graph.
…On Sun, Sep 30, 2018 at 7:10 AM Timothy Pulliam ***@***.***> wrote:
Is there a work around for this?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11337 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APE1VrPK5yBXLp_9sf462nVtKZGPdf7-ks5ugNC8gaJpZM4USDVm>
.
|
I'm also seeing this error using this conda environment...
|
Note this will still error if xmin=0. xmin>=1 for |
I think that path does the "right" thing, and doesn't update the view limits based on points that won't plot. I think its possible to argue that we should be able to handle |
I can think of many reasons why you'd want to plot very old dates, but it's pretty unusual to want to represent them in a proleptic Gregorian calendar (and even for those when you do want that, it's pretty rare to care about the time portion of it). Most of the functionality you gain by using a So what I will say is that support for out-of-bounds In this particular situation, I would want to avoid a solution that too-eagerly converts from |
The problem here is the converse - the default limits are 0-1 but the user supplied datetime to the x-axis so the converter is datetime, and then when ticking, it tries to convert 0 to a datetime and that fails. I guess the correct fix is when the axis first gets registered as datetime its default limits get changed to something other than 0-1. |
Hummm... possibly #11337 (comment) is related to #13463 (the comment mentioning that dates Locators likely need view_limits)? |
Yeah I was just looking at it... The default view interval gets set by |
Bug report
Bug summary
Cannot plot a fully masked array agaisnt an array of datetimes. A ValueError is raised for a seemingly unrelated reason. Surprisingly, matplotlib has no problem plotting a fully masked array by itself.
Code for reproduction
Actual outcome
Expected outcome
An empty graph. If you comment out
x
and don't plot against it, then matplotlib has no problem displaying an empty graph. It is only when you plot against a datetime array this is an issue.Matplotlib version
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inlineThe text was updated successfully, but these errors were encountered: