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

behavior when plotting no data #3886

Closed
eyurtsev opened this issue Dec 4, 2014 · 9 comments · Fixed by #4119
Closed

behavior when plotting no data #3886

eyurtsev opened this issue Dec 4, 2014 · 9 comments · Fixed by #4119

Comments

@eyurtsev
Copy link
Contributor

eyurtsev commented Dec 4, 2014

Minor issue, but some of the plotting functions work when there's no data and some don't.

# These work
plot([])
scatter([], [])
bar([], [])

# These raise a ValueError
hexbin([], [])
hist([])
hist2d([])
@tacaswell
Copy link
Member

I am not convinced that this is an actual issue as the functions that raise ValueError are actually doing computations and then using the results to create artists where as other functions are just creating artists.

A Line2D object with no data points still makes sense (the loops in draw are just no-ops) even if it seems a bit silly. On the other hand, I am not sure what it means to compute the histogram of an empty list (although numpy does let you do this....).

@tacaswell tacaswell added this to the unassigned milestone Dec 4, 2014
@WeatherGod
Copy link
Member

My own personal rule is that no data is still a valid use case (I do lots
of automation). Notice in the recently added quiver3d that we explicitly
handle the no data case prior to any calculation.

IIRC, I personally pushed for numpy's histogram to allow for empty input
arrays. I could have sworn I did the same for mpl, though...

On Thu, Dec 4, 2014 at 1:27 PM, Thomas A Caswell notifications@github.com
wrote:

I am not convinced that this is an actual issue as the functions that
raise ValueError are actually doing computations and then using the
results to create artists where as other functions are just creating
artists.

A Line2D object with no data points still makes sense (the loops in draw
are just no-ops) even if it seems a bit silly. On the other hand, I am not
sure what it means to compute the histogram of an empty list (although
numpy does let you do this....).


Reply to this email directly or view it on GitHub
#3886 (comment)
.

@mdboom
Copy link
Member

mdboom commented Dec 4, 2014

Yeah, I guess I agree with @WeatherGod here: it would be nice to support empty data wherever we can (though we certainly don't currently in all cases).

@eyurtsev
Copy link
Contributor Author

eyurtsev commented Dec 4, 2014

@tacaswell for a histogram it would be okay to produce an empty plot with the x and y axes, but without doing any binning. This is akin to how I would describe to someone my experimental data: first I would draw the axes, then I populate it with data. :)

@tacaswell
Copy link
Member

Yeah, I have come around on this.

@umairidris
Copy link

I have made some simple modifications to fix this issue. Please see #4119

Note: I was not able to reproduce this error with hist2d

@tacaswell
Copy link
Member

It should support empty data on master now...

On Tue, Feb 17, 2015, 18:34 umairidris notifications@github.com wrote:

I have made some simple modifications to fix this issue. Please see #4119
#4119

Note: I was not able to reproduce this error with hist2d


Reply to this email directly or view it on GitHub
#3886 (comment)
.

@tacaswell
Copy link
Member

OK, this is odd, I have a clear memory of changing this, but can't find it...

@tacaswell tacaswell modified the milestones: next point release, unassigned Feb 18, 2015
@tacaswell
Copy link
Member

#3883 is what I was thinking of and the constraints did to get as relaxed as I thought they did.

tacaswell added a commit that referenced this issue Mar 30, 2015
ENH : Allow empty input to hist and hexbin 

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

Successfully merging a pull request may close this issue.

5 participants