-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MEP12 improvments for statistics plots #7331
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
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. |
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.
Are all the plots PEP8-good now?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if -> of.
Missing period at end of sentence.
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.
Also, is there a reason for wrapping lines so early?
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 |
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.
Remove second 'of'.
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 |
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.
arists -> artists
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could maybe replace this with np.arange(1, ...)
instead.
Demo of the errorbar function | ||
============================= | ||
|
||
This exhibits the most basic use of of the error bar method. |
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.
Double 'of'.
Demo of how to produce multiple histograms side by side | ||
======================================================= | ||
|
||
This example plots horizonal histograms of different samples along |
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.
horizonal -> horizontal
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 |
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.
kernal -> kernel
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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``). |
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.
kde -> KDE
for consistency.
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 |
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.
emperical -> empirical
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.
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!
========================================= | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: demostrates -> demonstrates
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 |
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.
type: there is an extra of
=================================== | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
typo: in -> is
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 |
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.
👍
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"heights bins" or "height bins"? I never know…
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.
Neither: "bin heights"
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 (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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 😛 |
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.
One minor tweak.
|
||
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 |
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.
Missed on set of backticks.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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