MEP12 improvments for statistics plots#7331
Conversation
|
I've added those as being "done" on #7206. |
|
@NelleV cool, I'll update it as I go. |
5aadd99 to
bb8143a
Compare
|
Can you add the titling |
|
@QuLogic I don't follow. |
|
@phobson if the title is written in restructured text format, it will be rendered as so with sphinx-gallery. It is not requirement for the examples to be parsed properly, but it does look much nicer. |
QuLogic
left a comment
There was a problem hiding this comment.
Are all the plots PEP8-good now?
examples/statistics/boxplot_demo.py
Outdated
| mean is the only value not shown by default). The second | ||
| figure demonstrates how the styles of the artists of can | ||
| be customized. It also demonstrates how to set the limit | ||
| if the whiskers to specific percentiles (lower right axes) |
There was a problem hiding this comment.
if -> of.
Missing period at end of sentence.
There was a problem hiding this comment.
Also, is there a reason for wrapping lines so early?
examples/statistics/bxp_demo.py
Outdated
| statistics to the box plot drawer. The first figure demostrates | ||
| how to remove and add individual components (note that the | ||
| mean is the only value not shown by default). The second | ||
| figure demonstrates how the styles of the artists of can |
| The first plot shows the default style by providing only | ||
| the data. The second plot first limits what matplotlib draws | ||
| with additional kwargs. Then a simplified representation of | ||
| a box plot in drawn on top. Lastly, the styles of arists |
| for ax in [ax1, ax2]: | ||
| ax.get_xaxis().set_tick_params(direction='out') | ||
| ax.xaxis.set_ticks_position('bottom') | ||
| ax.set_xticks([x + 1 for x in range(len(lab))]) |
There was a problem hiding this comment.
You could maybe replace this with np.arange(1, ...) instead.
examples/statistics/errorbar_demo.py
Outdated
| Demo of the errorbar function | ||
| ============================= | ||
|
|
||
| This exhibits the most basic use of of the error bar method. |
| Demo of how to produce multiple histograms side by side | ||
| ======================================================= | ||
|
|
||
| This example plots horizonal histograms of different samples along |
| Violin plots are similar to histograms and box plots in that they show | ||
| an abstract representation of the probability distribution of the | ||
| sample. Rather than showing counts of data points that fall into bins | ||
| or order statistics, violin plots use kernal density estimation (KDE) to |
| or order statistics, violin plots use kernal density estimation (KDE) to | ||
| compute an emperical distribution of the sample. That computation | ||
| is controlled by several parameters. This example demostrates how to | ||
| modify the number of points at the KDE is evaluated (``points``) and |
There was a problem hiding this comment.
at -> at which (or maybe "for which", depending on the exact meaning.)
| compute an emperical distribution of the sample. That computation | ||
| is controlled by several parameters. This example demostrates how to | ||
| modify the number of points at the KDE is evaluated (``points``) and | ||
| how to modify the band-width of the kde (``bw_method``). |
| an abstract representation of the probability distribution of the | ||
| sample. Rather than showing counts of data points that fall into bins | ||
| or order statistics, violin plots use kernal density estimation (KDE) to | ||
| compute an emperical distribution of the sample. That computation |
NelleV
left a comment
There was a problem hiding this comment.
This looks good.
I've underlined a couple of typos, but this is a huge improvements in our examples. Thanks for the work put into this!
examples/statistics/boxplot_demo.py
Outdated
| ========================================= | ||
|
|
||
| This example demonstrates how to use the various kwargs | ||
| to fully customize box plots. The first figure demostrates |
There was a problem hiding this comment.
typo: demostrates -> demonstrates
examples/statistics/boxplot_demo.py
Outdated
| to fully customize box plots. The first figure demostrates | ||
| how to remove and add individual components (note that the | ||
| mean is the only value not shown by default). The second | ||
| figure demonstrates how the styles of the artists of can |
examples/statistics/bxp_demo.py
Outdated
| =================================== | ||
|
|
||
| This example demonstrates how to pass pre-computed box plot | ||
| statistics to the box plot drawer. The first figure demostrates |
There was a problem hiding this comment.
typo: demostrates -> demonstrates
| The first plot shows the default style by providing only | ||
| the data. The second plot first limits what matplotlib draws | ||
| with additional kwargs. Then a simplified representation of | ||
| a box plot in drawn on top. Lastly, the styles of the artists |
| called `make_error_boxes`. Close inspection of this function will reveal | ||
| the preferred pattern in writing functions for matplotlib: | ||
|
|
||
| 1. an `Axes` object is passed directly to the function |
| A couple of other options to the ``hist`` function are demonstrated. | ||
| Namely, we use the ``normed`` parameter to normalize the histogram and | ||
| a couple of different options to the `cumulative` parameter. Normalizing | ||
| a histogram means that the heights bins are scaled such that |
There was a problem hiding this comment.
"heights bins" or "height bins"? I never know…
| modify the number of points at which the KDE is evaluated (``points``) | ||
| and how to modify the band-width of the KDE (``bw_method``). | ||
|
|
||
| For more information on violin plots and KDE, the scikit-learn docs |
There was a problem hiding this comment.
👍 (I am of course totally biased…)
| for ax in [ax1, ax2]: | ||
| ax.get_xaxis().set_tick_params(direction='out') | ||
| ax.xaxis.set_ticks_position('bottom') | ||
| ax.set_xticks([x for x in np.arange(1, len(lab) + 1)]) |
There was a problem hiding this comment.
You don't need the list comprehension now.
146a417 to
a47556a
Compare
|
@QuLogic -- I never answered your question about PEP8. Yes. The |
0a00e9a to
8e0323b
Compare
You can't +1 your own PR 😛 |
|
|
||
| A couple of other options to the ``hist`` function are demonstrated. | ||
| Namely, we use the ``normed`` parameter to normalize the histogram and | ||
| a couple of different options to the `cumulative` parameter. Normalizing |
| Namely, we use the ``normed`` parameter to normalize the histogram and | ||
| a couple of different options to the `cumulative` parameter. Normalizing | ||
| a histogram means that the bin heights are scaled such that | ||
| the total area is 1. Since we're showing a normalized and |
There was a problem hiding this comment.
I still feel there's one sentence missing between here explaining what the cumulative argument does, or maybe the "Since..." sentence can go after the next paragraph.
There was a problem hiding this comment.
@QuLogic I took another stab at this. Let me know what you think.
|
|
||
| Since we're showing a normalized and cumulative histogram, these curves | ||
| are effectively the cumulative distribution functions (CDFs) of the | ||
| samples. In engineering, empirical CDFs where are sometimes called |
There was a problem hiding this comment.
An extra 'where' in this sentence.
|
Let me know if y'all want me to squash all of this (I'm inclined to do so). |
|
@phobson Whatever you prefer. Let me know, else I am going to merge. |
|
@NelleV I'll squash -- one sec |
7c7d1c7 to
076b98c
Compare
|
I'll wait until the checks finish running before merging :) |
|
Cool. I'll take a stab at that soon. On Sunday, October 23, 2016, Elliott Sales de Andrade <
Sent from my sorry. Sorry about the typos. |
|
Ha. Sorry. That was a response to the approval. On Sunday, October 23, 2016, Elliott Sales de Andrade <
Sent from my sorry. Sorry about the typos. |
|
So… the backport doesn't apply cleanly and I got distracted by something else. |
MEP12 improvments for statistics plots
|
Backported to v2.x via 58cc83d. |
This isn't ready yet -- but I noticed a lot of MEP12 PRs, so I wanted to get this up sooner to avoid duplicate efforts