Clarify the uses of whiskers float parameter. #7753

Merged
merged 1 commit into from Jan 12, 2017

Projects

None yet

5 participants

@Carreau
Contributor
Carreau commented Jan 6, 2017

It is not clear (at least to a couple of non-native English speakers)
that the whiskers extend to the last data point. More precisely:

"If it's 1.5 times Q3-Q1 it should be symmetric"

The code does seem to limit the whisker to the last data point, and that
correspond to one of the usage of whiskers described by Wikipedia.

So fix docstrings.


Improvement thanks to @EmilienSchultz, but I already had a matplotlib clone and a dev install, so it was faster for me to fix it.

@codecov-io

Current coverage is 62.12% (diff: 100%)

Merging #7753 into master will not change coverage

@@             master      #7753   diff @@
==========================================
  Files           174        174          
  Lines         56028      56028          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          34805      34805          
  Misses        21223      21223          
  Partials          0          0          

Powered by Codecov. Last update 1fa4dd7...a7b04b1

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Jan 6, 2017
@tacaswell tacaswell requested a review from phobson Jan 6, 2017
lib/matplotlib/axes/_axes.py
+ As a float, determines the reach of the whiskers to the first
+ (resp. last) datum past the first (resp. third) quartiles
+ (e.g., Q3 + whis*IQR, IQR = interquartile range, Q3-Q1,
+ whisker will be at the last data point of Q3 + whis*IQR).
@tacaswell
tacaswell Jan 6, 2017 Member

"will be at last data point less than Q3 + whis*IQR."?

@Carreau
Carreau Jan 6, 2017 Contributor

Changed to your wording.

@Carreau
Carreau Jan 6, 2017 Contributor

(in both docstrings)

@phobson
phobson requested changes Jan 6, 2017 edited View changes

I think this is headed in the right direction. I would recommend:

As a float, determines the reach of the whiskers to the beyond the first and third quartiles. In other words, where IQR is the interquartile range (Q3-Q1), the upper whisker will extend to last datum less than Q3 + whis*IQR). Similarly, the lower whisker will extend to the first datum greater than Q1 - whis*IQR.

@phobson
Member
phobson commented Jan 6, 2017

FWIW, wikipedia currently explains this as:

the lowest datum still within 1.5 IQR of the lower quartile, and the highest datum still within 1.5 IQR of the upper quartile.

I think that would work as well (with attribution)

@Carreau Carreau Clarify the uses of whiskers float parameter.
It is not clear (at least to a couple of non-native English speakers)
that the whiskers extend to the last data point. More precisely:

> "If it's 1.5 times Q3-Q1 it should be symmetric"

The code does seem to limit the whisker to the last data point, and that
correspond to one of the usage of whiskers described by Wikipedia.

So fix docstrings.
97609a8
@Carreau
Contributor
Carreau commented Jan 12, 2017

@phobson pushed with your first phrasing. I find it clearer than the wikipedia one.

@phobson

Thanks!

@NelleV
Contributor
NelleV commented Jan 12, 2017

The failure is unrelated to the patch, so I'm merging.
Thanks @Carreau !

@NelleV NelleV merged commit 4d390fa into matplotlib:master Jan 12, 2017

1 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
coverage/coveralls Coverage increased (+0.004%) to 62.1%
Details
@Carreau Carreau deleted the Carreau:improve-whiskers-docstrings branch Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment