FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MEP12 improvments for statistics plots by phobson · Pull Request #7331 · matplotlib/matplotlib · GitHub

Repository navigation

MEP12 improvments for statistics plots - #7331

Merged
NelleV merged 1 commit into
matplotlib:masterfrom
phobson:MEP12-statistic-plots
Oct 25, 2016
Merged

NelleV merged 1 commit into
matplotlib:masterfrom
phobson:MEP12-statistic-plots

Conversation

phobson commented Oct 22, 2016

Copy link
Copy Markdown
Member

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

phobson added Documentation MEP: MEP12 gallery and examples improvements labels Oct 22, 2016
phobson added this to the 2.0.1 (next bug fix release) milestone Oct 22, 2016
phobson self-assigned this Oct 22, 2016

NelleV commented Oct 22, 2016

Copy link
Copy Markdown
Member

I've added those as being "done" on #7206.

phobson commented Oct 22, 2016

Copy link
Copy Markdown
Member Author

@NelleV cool, I'll update it as I go.

phobson force-pushed the MEP12-statistic-plots branch from 5aadd99 to bb8143a Compare October 22, 2016 19:26
phobson changed the title (WIP) MEP12 improvments for statistics plots MEP12 improvments for statistics plots Oct 22, 2016

QuLogic commented Oct 22, 2016

Copy link
Copy Markdown
Member

Can you add the titling =s while you're here?

phobson commented Oct 22, 2016

Copy link
Copy Markdown
Member Author

@QuLogic I don't follow.

NelleV commented Oct 22, 2016

Copy link
Copy Markdown
Member

@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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Are all the plots PEP8-good now?

Comment thread 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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if -> of.
Missing period at end of sentence.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Also, is there a reason for wrapping lines so early?

Comment thread 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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))])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You could maybe replace this with np.arange(1, ...) instead.

Comment thread examples/statistics/errorbar_demo.py Outdated
Demo of the errorbar function
=============================

This exhibits the most basic use of of the error bar method.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Double 'of'.

Demo of how to produce multiple histograms side by side
=======================================================

This example plots horizonal histograms of different samples along

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

horizonal -> horizontal

Comment thread examples/statistics/violinplot_demo.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

kernal -> kernel

Comment thread examples/statistics/violinplot_demo.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

at -> at which (or maybe "for which", depending on the exact meaning.)

Comment thread examples/statistics/violinplot_demo.py Outdated
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``).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

kde -> KDE
for consistency.

Comment thread examples/statistics/violinplot_demo.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

emperical -> empirical

NelleV left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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!

Comment thread examples/statistics/boxplot_demo.py Outdated
=========================================

This example demonstrates how to use the various kwargs
to fully customize box plots. The first figure demostrates

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

typo: demostrates -> demonstrates

Comment thread 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

type: there is an extra of

Comment thread 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

"heights bins" or "height bins"? I never know…

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍 (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)])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You don't need the list comprehension now.

phobson force-pushed the MEP12-statistic-plots branch from 146a417 to a47556a Compare October 23, 2016 15:39

phobson commented Oct 23, 2016

Copy link
Copy Markdown
Member Author

@QuLogic -- I never answered your question about PEP8. Yes. The pep8 that I ran locally w/o any exceptions didn't complain at all and Travis was happy with the last pass at them.

phobson force-pushed the MEP12-statistic-plots branch from 0a00e9a to 8e0323b Compare October 23, 2016 16:01
phobson changed the title MEP12 improvments for statistics plots [MRG+1]MEP12 improvments for statistics plots Oct 23, 2016

QuLogic commented Oct 24, 2016

Copy link
Copy Markdown
Member

@phobson phobson changed the title from MEP12 improvments for statistics plots to [MRG+1]MEP12 improvments for statistics plots 2 hours ago

You can't +1 your own PR 😛

QuLogic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@QuLogic I took another stab at this. Let me know what you think.

QuLogic changed the title [MRG+1]MEP12 improvments for statistics plots [MRG]MEP12 improvments for statistics plots Oct 24, 2016
NelleV changed the title [MRG]MEP12 improvments for statistics plots [MRG+1] MEP12 improvments for statistics plots Oct 24, 2016

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

An extra 'where' in this sentence.

phobson commented Oct 25, 2016

Copy link
Copy Markdown
Member Author

Let me know if y'all want me to squash all of this (I'm inclined to do so).

NelleV commented Oct 25, 2016

Copy link
Copy Markdown
Member

@phobson Whatever you prefer. Let me know, else I am going to merge.

phobson commented Oct 25, 2016

Copy link
Copy Markdown
Member Author

@NelleV I'll squash -- one sec

phobson force-pushed the MEP12-statistic-plots branch from 7c7d1c7 to 076b98c Compare October 25, 2016 15:38

NelleV commented Oct 25, 2016

Copy link
Copy Markdown
Member

I'll wait until the checks finish running before merging :)

NelleV merged commit 3127815 into matplotlib:master Oct 25, 2016

phobson commented Oct 25, 2016

Copy link
Copy Markdown
Member Author

Cool. I'll take a stab at that soon.

On Sunday, October 23, 2016, Elliott Sales de Andrade <
notifications@github.com> wrote:

@QuLogic commented on this pull request.

One minor tweak.

In examples/statistics/histogram_demo_cumulative.py
#7331 (review)
:

@@ -1,29 +1,72 @@
"""
-Demo of the histogram (hist) function used to plot a cumulative distribution.
+==========================================================
+Demo of using histograms to plot a cumulative distribution
+==========================================================
+
+This shows how to plot a cumulative, normalized histogram as a
+step function in order to visualize the empirical cumulative
+distribution function (CDF) of a sample. We also use the mlab
+module to show the theoretical CDF.
+
+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

Missed on set of backticks.

In examples/statistics/histogram_demo_cumulative.py
#7331 (review)
:

@@ -1,29 +1,72 @@
"""
-Demo of the histogram (hist) function used to plot a cumulative distribution.
+==========================================================
+Demo of using histograms to plot a cumulative distribution
+==========================================================
+
+This shows how to plot a cumulative, normalized histogram as a
+step function in order to visualize the empirical cumulative
+distribution function (CDF) of a sample. We also use the mlab
+module to show the theoretical CDF.
+
+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 bin heights are scaled such that
+the total area is 1. Since we're showing a normalized and

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.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7331 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABHCo7B8tmzPfT0-pZfu1-fH6khGRbC6ks5q2_6EgaJpZM4Kd5xr
.

Sent from my sorry. Sorry about the typos.

phobson commented Oct 25, 2016

Copy link
Copy Markdown
Member Author

Ha. Sorry. That was a response to the approval.

On Sunday, October 23, 2016, Elliott Sales de Andrade <
notifications@github.com> wrote:

@phobson https://github.com/phobson phobson changed the title from
MEP12 improvments for statistics plots to [MRG+1]MEP12 improvments for
statistics plots 2 hours ago

You can't +1 your own PR 😛

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7331 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABHCo5Z04c0HdOZ2Vo4ru9cmzhjs7PbGks5q2_yogaJpZM4Kd5xr
.

Sent from my sorry. Sorry about the typos.

NelleV commented Oct 25, 2016

Copy link
Copy Markdown
Member

So… the backport doesn't apply cleanly and I got distracted by something else.
@tacaswell do you mind doing it?

QuLogic pushed a commit that referenced this pull request Oct 25, 2016
QuLogic changed the title [MRG+1] MEP12 improvments for statistics plots MEP12 improvments for statistics plots Oct 25, 2016

QuLogic commented Oct 25, 2016

Copy link
Copy Markdown
Member

Backported to v2.x via 58cc83d.

phobson deleted the MEP12-statistic-plots branch October 25, 2016 23:29
QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0 (style change major release) Dec 7, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation MEP: MEP12 gallery and examples improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL