Draft version of MEP28: Simplification of boxplots#7282
Draft version of MEP28: Simplification of boxplots#7282NelleV merged 1 commit intomatplotlib:masterfrom
Conversation
doc/devel/MEP/MEP28.rst
Outdated
| importantly, at the very least, seaborn would require no changes to its | ||
| API to allow users to take advantage of these new options. | ||
|
|
||
| Simiplifications to the ``Axes.boxplot`` API and other functions |
There was a problem hiding this comment.
small typo : Simiplifications -> simplifications
NelleV
left a comment
There was a problem hiding this comment.
Here is a couple of very small typo fixes.
I'll do a second review once I have enough caffeine flowing…
doc/devel/MEP/MEP28.rst
Outdated
| :local: | ||
|
|
||
|
|
||
| This MEP template is a guideline of the sections that a MEP should |
There was a problem hiding this comment.
I think you are meant to remove this :)
doc/devel/MEP/MEP28.rst
Outdated
| ====================== | ||
|
|
||
| Implementation of this MEP would eventually result in the backwards | ||
| incompatible deprecation and then removeal of the keyword parameters |
| ``usermedians``, ``conf_intervals``, and ``sym``. Curosry searches on | ||
| GitHub indicated that ``usermedians``, ``conf_intervals`` are used by | ||
| few users, who all seem to have a very strong knowledge of matplotlib. | ||
| A robust deprecation cycle should provide sufficient time for these |
There was a problem hiding this comment.
Considering we are have discussion about one release cycle versus two release cycle on the finance module right now, it might be worth being specific here.
doc/devel/MEP/MEP28.rst
Outdated
| arguments and can easily be set to ``lambda x: x`` as a no-op when omitted | ||
| by the user. The ``transform_in`` function will be applied to the data | ||
| as the ``boxplot_stats`` function loops through each subset of the data | ||
| pass to it. After the list of statistics dictionaries are computed the |
| This MEP seeks to dramatically simplify the creation of boxplots for | ||
| novice and advanced users alike. Importantly, the changes proposed here | ||
| will also be available to downstream packages like seaborn, as seaborn | ||
| smartly allows users to pass arbitrary dictionaries of parameters through |
There was a problem hiding this comment.
So, a little unclear about scope delineation here. What does seaborn do above and beyond mpl? And how is this not creeping into seaborn's territory.
There was a problem hiding this comment.
My thought is that these few changes should be implemented in such a way that seaborn users have access to them without seaborn needing to change at all. Shooting for simplicity and flexibility for users and downstream libraries
There was a problem hiding this comment.
Hmm, so you want to maintain downstream use, but you plan to remove **kwargs. Is there verification that seaborn doesn't use those args? Granted, this seems like it'd be a pretty small PR on seaborn if it does change things with them..
There was a problem hiding this comment.
seaborn uses very few parameters and just passes everything else from the user as **kws. Also instances of call matplotlib's boxplot API are below:
- https://github.com/mwaskom/seaborn/blob/dd8ab4985eadba43c94542cfad56a78dcfefef31/seaborn/categorical.py#L468
- https://github.com/mwaskom/seaborn/blob/dd8ab4985eadba43c94542cfad56a78dcfefef31/seaborn/categorical.py#L497
Next step would be to checkout yhat's python-ggplot
There was a problem hiding this comment.
welp ggplot impliments their own boxplot drawer: https://github.com/yhat/ggplot/blob/5957a4db941be1da578ecc462d1f5b99f6d776ab/ggplot/geoms/geom_boxplot.py
There was a problem hiding this comment.
In some ways that's probably good in that it means you don't have to worry about downstream support with ggplot.
There was a problem hiding this comment.
you're absolutely right about that. i guess it just makes me feel insecure about our implementation.
doc/devel/MEP/MEP28.rst
Outdated
| 2. v2.1.0 deprecate ``usermedians``, ``conf_intervals``, ``sym`` parameters | ||
| 3. v2.2.0 make deprecations noisier (???) | ||
| 3. v2.3.0 remove ``usermedians``, ``conf_intervals``, ``sym`` parameters | ||
| 4. v2.3.0 deprecate ``notch`` in favor of ``shownotches`` to be consistent with |
There was a problem hiding this comment.
Ugh, the inconsistency irks me. Like half the things, like conf_intervals put an _ between separate words and half, like shownotches don't.
There was a problem hiding this comment.
I accept full responsibility for that
There was a problem hiding this comment.
Any interest in deprecating args to move towards consistency?
There was a problem hiding this comment.
Which did you have in mind? that was my intention with moving from notch to shownotches
There was a problem hiding this comment.
moving stuff like shownotches to show_notches since that seems to be more pythonic.
There was a problem hiding this comment.
I'd be open minded about that, my initial inclination is to leave out the underscores.
doc/devel/MEP/MEP28.rst
Outdated
| With this approach, #2 depends and #1, and #4 depends on #3. | ||
|
|
||
| There are two possible approaches to #2. The first and most direct would | ||
| be to minor the new ``transform_in`` and ``tranform_out`` parameters of |
There was a problem hiding this comment.
not clear what "to minor" means here.
| be to minor the new ``transform_in`` and ``tranform_out`` parameters of | ||
| ``cbook.boxplot_stats`` in ``Axes.boxplot`` and pass them directly. | ||
|
|
||
| The second approach would be to add ``statfxn`` and ``statfxn_args`` |
There was a problem hiding this comment.
any chance of psuedocode like examples of the two approaches?
|
@story645 I've added some examples of what the final |
doc/devel/MEP/MEP28.rst
Outdated
| The second approach would be to add ``statfxn`` and ``statfxn_args`` | ||
| parameters to ``Axes.boxplot``. Under this implementation, the default | ||
| value of ``statfxn`` would be ``cbook.boxplot_stats``, but users could | ||
| pass their own function. Then `transform_in`` and ``tranform_out`` would |
There was a problem hiding this comment.
You are missing a backtick ` here.
|
|
||
| Using matplotlib's stats function, this would look similar to this: | ||
|
|
||
| .. python: |
There was a problem hiding this comment.
To be very annoying, ( 😄 ) could you add an example of how you would do this with the current API?
The difference would be more striking.
|
My 2 cents is that we should merge this as "draft" quite quickly, and have discussion on the mailing list on the details. |
|
@NelleV I'm going to clean this up tonight to make sure that the docs build (my |
doc/devel/MEP/MEP28.rst
Outdated
| Abstract | ||
| ======== | ||
|
|
||
| Over the past few releases, the ``Axes.boxplot`` method as grown in |
doc/devel/MEP/MEP28.rst
Outdated
| ======== | ||
|
|
||
| Over the past few releases, the ``Axes.boxplot`` method as grown in | ||
| complexity to support fully customizable artist styline and statistics |
There was a problem hiding this comment.
styline -> styling?
statistics -> statistical
doc/devel/MEP/MEP28.rst
Outdated
| the results to ``Axes.bxp``, and pre-processing style information for | ||
| each facet of the boxplot plots. | ||
|
|
||
| This MEP will outline a path forward to roll-back the added complexity |
doc/devel/MEP/MEP28.rst
Outdated
| users to specify medians and confidence intervals for each box that | ||
| will be drawn in the plot. These were provided so that avdanced users | ||
| could provide statistics computed in a different fashion that the simple | ||
| method provided by matplotlob. However, handling this input requires |
doc/devel/MEP/MEP28.rst
Outdated
| could provide statistics computed in a different fashion that the simple | ||
| method provided by matplotlob. However, handling this input requires | ||
| complex logic to make sure that the forms of the data structure match what | ||
| needs to be drawn. At the moment, that logic contain 9 separate if/else |
doc/devel/MEP/MEP28.rst
Outdated
| With this approach, #2 depends and #1, and #4 depends on #3. | ||
|
|
||
| There are two possible approaches to #2. The first and most direct would | ||
| be to minor the new ``transform_in`` and ``tranform_out`` parameters of |
doc/devel/MEP/MEP28.rst
Outdated
| The second approach would be to add ``statfxn`` and ``statfxn_args`` | ||
| parameters to ``Axes.boxplot``. Under this implementation, the default | ||
| value of ``statfxn`` would be ``cbook.boxplot_stats``, but users could | ||
| pass their own function. Then `transform_in`` and ``tranform_out`` would |
There was a problem hiding this comment.
Missing a backtick.
tranform_out -> transform_out
doc/devel/MEP/MEP28.rst
Outdated
| parameters to ``Axes.boxplot``. Under this implementation, the default | ||
| value of ``statfxn`` would be ``cbook.boxplot_stats``, but users could | ||
| pass their own function. Then `transform_in`` and ``tranform_out`` would | ||
| then be passes as elements of the ``statfxn_args`` parameter. |
doc/devel/MEP/MEP28.rst
Outdated
| if key != 'label': | ||
| s[key] = np.exp(value) | ||
|
|
||
| ax.bmp(stats, ...) |
doc/devel/MEP/MEP28.rst
Outdated
| Doing less | ||
| ---------- | ||
|
|
||
| Another obvious alternative would be to omitted the added pre- and post- |
|
@phobson the doc build is still not happening. If you have everything installed, the quickest by be to test on your computer with the parallelization option. |
|
@NelleV Correct -- I need to include the API clarifications in my long comment above and then I'll get the doc builds working. Sorry this is dragging out. Relearning transportation and structural engineering + the day job are filling my plate. |
|
Let's move the discussion to somewhere more public. |
|
@NelleV thanks! |
|
I guess it only fitting that @phobson sends the email to the mailing list. |
This a MEP for a series of small changes that will
cbook.boxplot_stats,Axes.boxplot, andAxes.bxpseabornwith no action required on their part