-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: decide what to return from plotting functions #4020
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
there was a link a while back that covered this...some issue having to do with statsmodels. |
@cpcloud here's what I was thinking of - #1501 (comment) - apparently standard is figure? |
i guess so; maybe it got lost in the mix, wanted to make sure this is addressed in 0.13 |
i think #1501 is just about probability plots not sure if the API was ever resolved, but returning |
why wouldn't we standardize on returning axes? and just do a 1 time API change where needed? I think makes most sense can u make a list what everything returns now? |
this is why we wouldn't standardize on return axes: #1501 (comment) i agree that it would be nice to standardize on axes, but that's different than what the comment says is the standard. |
(that's a link to a comment) |
where does it say its not the standard? |
the list:
all of the above return an methods
top-level plotting
|
I think there is an issue to fix box plot already is there a reason for the top level plotting at all ? why are these not all done via the kind to plot? then everything can return an axes or ndarray of axes ? |
not sure .... looks like a handful of different authors on those functions. maybe @wesm knows? |
@jreback re your previous question, this:
|
ic except that breaks everything! maybe like matplotlob fig, ax = func(...) ? |
one thing to note is that anything returning |
not sure if that's an ipython bug, i don't think so bc that's actually a way to show the plot again |
why do u think sm returns figures? |
not sure since most of the time if you want to change things u don't need the fig u need the axes |
let me go read the pydata discussion again...maybe there's some logic behind why they do it |
I say practicality - lets return ax could have a option return_figure to provide the figure instead (I don't like doing that but no choice really) |
it's so weird....it's so simple to get the figure by just calling i agree tho, return axes (or i honestly can't think of a time ever when i've modified the figure except trivial cases of |
what do to about boxplot? it's the runt of the bunch with its dict of whatever return value |
I read the discussion they always return a figure because then u don't have to know whether u get an ax or ndarray of axes I would just have everything return as now ten deprecate all I the top level methods and use kind (if possible) |
[disclaimer, speaking for my self, not mpl here] It is better to return the If the user did not pass in an Returning artists from plotting commands would also bring the pandas API in line with the upstream mpl api. I would also advocate moving all of the pandas plotting methods to be functions in a top level module with signatures like All of these changes will make it easier to (eventually) move pandas aware plotting to an mpl umbrella organization project. |
It think the plotting API return types have been solidified for years now so I think we can close this out. If we decide to change a return type we can open a individual issue |
most plotting functions return an
Artist
instance whereas a few return something else. for example,boxplot
returns adict
andscatter
returns atuple
. they should at least return amatplotlib.artist.Artist
subclass (usually either aFigure
orAxes
) or an array ofArtist
s.this has been brought up before but it would be nice to make a decision here.
mailing list thread and #3474.
The text was updated successfully, but these errors were encountered: