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
ENH/REF: Overhauled boxplots #2643
Conversation
…tats) and a drawer (axes.bxp). Existing function now relies on these two functions.
TST: added tests for all of bxp and more boxplot tests TST: fixed boxplot baseline image TST: added baseline images for bxp
…o outliers as fliers
ENH/TST: boxplots stats now takes a labels kwarg MNT: minor PEP8 whitespace fix
I don't think it is worth re-fitting You need to add it to the list There was discussion about doing away with |
@tacaswell To be fair, I think we can add the new stuff to Thanks for the other tips. I'll look into them soon. |
…) or specified percentiles. If IQR is zero, min/max are used
def dopatch(xs, ys, **kwargs): | ||
xs, ys = ys, xs # flip X, Y | ||
return patch_list(xs, ys, **kwargs) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to have this logic shuffle/flip the data and only have the plotting once rather than creating inner functions which do both the data munging and the plotting (sorry if it become obvious later why you did it this way).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tacaswell I could definitely rearrange that as you describe. this is just an vestige of the original boxplot code. luckily I think i have enough tests now that I'll know if I break something :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tacaswell, my first reaction probably would be like yours, but looking farther down in the code, I think that using these local functions is actually the cleanest way to encapsulate the axis flip.
I left a few picky comments that other should comment on before you do anything about. I am also not sure about the |
@tacaswell thanks for the feedback. As you suggested, I'll wait for more comments. The |
Your comment re This looks like a really nice PR. |
Happy to take a look at the |
pretty sure the doc-build process takes care of that, but I have not done much with it. The easy thing is to run the doc-build locally and see if it takes care of it. Yes, I was not suggesting you do the candlestick in this PR (or even that you should do it). It would be good to find a person who does finance to take care of that module/toolkit, but that is irrelevant for this PR. |
@tacaswell |
@phobson This needs a re-base. It looks good to merge to me, but I don't want to push the button on this much new code without someone else looking at it. |
@tacaswell do i need to rebase to squash the commits, to sync with current master, or both? |
relies on a new function (:func:`~matplotlib.cbook.boxplot_stats`), which | ||
accepts any data structure currently compatible with | ||
:func:`~matplotlib.pyplot.boxplot`, amd returns a list of dictaries | ||
containing the positions of each of artists for the boxplots. Then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "each of the artists"? This is still not very clear.
ENH/REF: Overhauled boxplots
@phobson Merged! Thanks for this. |
@tacaswell wooo! thanks for the guidance and patience |
In a nut shell here is what has happened:
cbook.boxplot_stats
) that take any data thataxes.boxplot
could handle and generates a list of dicts containing the statistics needed to draw a set of boxplots.axes.bxp
) that accepts dictionaries fromcbook.boxplot_stats
and allows the user to customize how the plots are rendering. In other words, dictionaries of style **kwargs can be passed configuring the style of the boxes/whisker/caps, the outliers, the medians, the means (new functionality).bxp
method also allows the user to toggle the drawing of any element of the boxplot via **kwargs (i.e.,shownotches
,showboxes
,showfliers
,showmeans
,showcaps
).bxp
looks for alabel
key in the dictionaries. If it's available, it'll use that as the x-tick label. Otherwise, the labels default to the boxplot's position.boxplot
method is functionally unchanged, but now it relies oncbook.boxplot_stats
andaxes.bxp
to do all the work.Potential remaining items:
Well, I definitely need to draft up a good example to show all of this off. That's coming shortly (pending feedback on the existing portions of the PR).We might want to expose the full capability of(done)bxp
inboxplot
(i.e., the style andshow*
kwargs). Currently,boxplot
's API/capabiltiy is unchanged. I'm fine with this but I'll need to pretty much duplicate all of thebxp
tests to make sure nothings gets lost in translation,Rerunning boilerplate.py didn't seem to pick up onbxp
. Do I need to clear it out first?We might want to add(not gonna happen)boxplot_stats
topyplot
andpylab
.And it looks like boilerplate.py added a bunch of unicode strings to the call sigs and now the 3.2 build is failing (dang it).(fixed that)This PR addresses the following issue (or allows users to address them themselves):
There is all #1027 out there. While we don't address that issue directly. I personally agree with matplotlib's approach to boxplots that brings up that issue. In other words, that's a feature, not a bug, IMO