Skip to content

Commit bf51375

Browse files
committed
Merge branch 'v1.5.x' into v2.0.x
2 parents d730481 + 46e9f22 commit bf51375

File tree

2 files changed

+118
-104
lines changed

2 files changed

+118
-104
lines changed

lib/matplotlib/axes/_axes.py

+103-104
Original file line numberDiff line numberDiff line change
@@ -3062,116 +3062,115 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
30623062
30633063
Parameters
30643064
----------
3065+
x : Array or a sequence of vectors.
3066+
The input data.
3067+
3068+
notch : bool, default = False
3069+
If False, produces a rectangular box plot.
3070+
If True, will produce a notched box plot
3071+
3072+
sym : str or None, default = None
3073+
The default symbol for flier points.
3074+
Enter an empty string ('') if you don't want to show fliers.
3075+
If `None`, then the fliers default to 'b+' If you want more
3076+
control use the flierprops kwarg.
3077+
3078+
vert : bool, default = True
3079+
If True (default), makes the boxes vertical.
3080+
If False, makes horizontal boxes.
3081+
3082+
whis : float, sequence (default = 1.5) or string
3083+
As a float, determines the reach of the whiskers past the first
3084+
and third quartiles (e.g., Q3 + whis*IQR, IQR = interquartile
3085+
range, Q3-Q1). Beyond the whiskers, data are considered outliers
3086+
and are plotted as individual points. Set this to an unreasonably
3087+
high value to force the whiskers to show the min and max values.
3088+
Alternatively, set this to an ascending sequence of percentile
3089+
(e.g., [5, 95]) to set the whiskers at specific percentiles of
3090+
the data. Finally, *whis* can be the string 'range' to force the
3091+
whiskers to the min and max of the data. In the edge case that
3092+
the 25th and 75th percentiles are equivalent, *whis* will be
3093+
automatically set to 'range'.
3094+
3095+
bootstrap : None (default) or integer
3096+
Specifies whether to bootstrap the confidence intervals
3097+
around the median for notched boxplots. If bootstrap==None,
3098+
no bootstrapping is performed, and notches are calculated
3099+
using a Gaussian-based asymptotic approximation (see McGill, R.,
3100+
Tukey, J.W., and Larsen, W.A., 1978, and Kendall and Stuart,
3101+
1967). Otherwise, bootstrap specifies the number of times to
3102+
bootstrap the median to determine it's 95% confidence intervals.
3103+
Values between 1000 and 10000 are recommended.
3104+
3105+
usermedians : array-like or None (default)
3106+
An array or sequence whose first dimension (or length) is
3107+
compatible with *x*. This overrides the medians computed by
3108+
matplotlib for each element of *usermedians* that is not None.
3109+
When an element of *usermedians* == None, the median will be
3110+
computed by matplotlib as normal.
3111+
3112+
conf_intervals : array-like or None (default)
3113+
Array or sequence whose first dimension (or length) is compatible
3114+
with *x* and whose second dimension is 2. When the current element
3115+
of *conf_intervals* is not None, the notch locations computed by
3116+
matplotlib are overridden (assuming notch is True). When an
3117+
element of *conf_intervals* is None, boxplot compute notches the
3118+
method specified by the other kwargs (e.g., *bootstrap*).
30653119
3066-
x : Array or a sequence of vectors.
3067-
The input data.
3068-
3069-
notch : bool, default = False
3070-
If False, produces a rectangular box plot.
3071-
If True, will produce a notched box plot
3072-
3073-
sym : str or None, default = None
3074-
The default symbol for flier points.
3075-
Enter an empty string ('') if you don't want to show fliers.
3076-
If `None`, then the fliers default to 'b+' If you want more
3077-
control use the flierprops kwarg.
3078-
3079-
vert : bool, default = True
3080-
If True (default), makes the boxes vertical.
3081-
If False, makes horizontal boxes.
3082-
3083-
whis : float, sequence (default = 1.5) or string
3084-
As a float, determines the reach of the whiskers past the first
3085-
and third quartiles (e.g., Q3 + whis*IQR, IQR = interquartile
3086-
range, Q3-Q1). Beyond the whiskers, data are considered outliers
3087-
and are plotted as individual points. Set this to an unreasonably
3088-
high value to force the whiskers to show the min and max values.
3089-
Alternatively, set this to an ascending sequence of percentile
3090-
(e.g., [5, 95]) to set the whiskers at specific percentiles of
3091-
the data. Finally, *whis* can be the string 'range' to force the
3092-
whiskers to the min and max of the data. In the edge case that
3093-
the 25th and 75th percentiles are equivalent, *whis* will be
3094-
automatically set to 'range'.
3095-
3096-
bootstrap : None (default) or integer
3097-
Specifies whether to bootstrap the confidence intervals
3098-
around the median for notched boxplots. If bootstrap==None,
3099-
no bootstrapping is performed, and notches are calculated
3100-
using a Gaussian-based asymptotic approximation (see McGill, R.,
3101-
Tukey, J.W., and Larsen, W.A., 1978, and Kendall and Stuart,
3102-
1967). Otherwise, bootstrap specifies the number of times to
3103-
bootstrap the median to determine it's 95% confidence intervals.
3104-
Values between 1000 and 10000 are recommended.
3105-
3106-
usermedians : array-like or None (default)
3107-
An array or sequence whose first dimension (or length) is
3108-
compatible with *x*. This overrides the medians computed by
3109-
matplotlib for each element of *usermedians* that is not None.
3110-
When an element of *usermedians* == None, the median will be
3111-
computed by matplotlib as normal.
3112-
3113-
conf_intervals : array-like or None (default)
3114-
Array or sequence whose first dimension (or length) is compatible
3115-
with *x* and whose second dimension is 2. When the current element
3116-
of *conf_intervals* is not None, the notch locations computed by
3117-
matplotlib are overridden (assuming notch is True). When an
3118-
element of *conf_intervals* is None, boxplot compute notches the
3119-
method specified by the other kwargs (e.g., *bootstrap*).
3120-
3121-
positions : array-like, default = [1, 2, ..., n]
3122-
Sets the positions of the boxes. The ticks and limits
3123-
are automatically set to match the positions.
3124-
3125-
widths : array-like, default = 0.5
3126-
Either a scalar or a vector and sets the width of each box. The
3127-
default is 0.5, or ``0.15*(distance between extreme positions)``
3128-
if that is smaller.
3129-
3130-
labels : sequence or None (default)
3131-
Labels for each dataset. Length must be compatible with
3132-
dimensions of *x*
3133-
3134-
patch_artist : bool, default = False
3135-
If False produces boxes with the Line2D artist
3136-
If True produces boxes with the Patch artist
3137-
3138-
showmeans : bool, default = False
3139-
If True, will toggle one the rendering of the means
3140-
3141-
showcaps : bool, default = True
3142-
If True, will toggle one the rendering of the caps
3143-
3144-
showbox : bool, default = True
3145-
If True, will toggle one the rendering of box
3146-
3147-
showfliers : bool, default = True
3148-
If True, will toggle one the rendering of the fliers
3149-
3150-
boxprops : dict or None (default)
3151-
If provided, will set the plotting style of the boxes
3152-
3153-
whiskerprops : dict or None (default)
3154-
If provided, will set the plotting style of the whiskers
3155-
3156-
capprops : dict or None (default)
3157-
If provided, will set the plotting style of the caps
3158-
3159-
flierprops : dict or None (default)
3160-
If provided, will set the plotting style of the fliers
3161-
3162-
medianprops : dict or None (default)
3163-
If provided, will set the plotting style of the medians
3164-
3165-
meanprops : dict or None (default)
3120+
positions : array-like, default = [1, 2, ..., n]
3121+
Sets the positions of the boxes. The ticks and limits
3122+
are automatically set to match the positions.
3123+
3124+
widths : array-like, default = 0.5
3125+
Either a scalar or a vector and sets the width of each box. The
3126+
default is 0.5, or ``0.15*(distance between extreme positions)``
3127+
if that is smaller.
3128+
3129+
labels : sequence or None (default)
3130+
Labels for each dataset. Length must be compatible with
3131+
dimensions of *x*
3132+
3133+
patch_artist : bool, default = False
3134+
If False produces boxes with the Line2D artist
3135+
If True produces boxes with the Patch artist
3136+
3137+
showmeans : bool, default = False
3138+
If True, will toggle one the rendering of the means
3139+
3140+
showcaps : bool, default = True
3141+
If True, will toggle one the rendering of the caps
3142+
3143+
showbox : bool, default = True
3144+
If True, will toggle one the rendering of box
3145+
3146+
showfliers : bool, default = True
3147+
If True, will toggle one the rendering of the fliers
3148+
3149+
boxprops : dict or None (default)
3150+
If provided, will set the plotting style of the boxes
3151+
3152+
whiskerprops : dict or None (default)
3153+
If provided, will set the plotting style of the whiskers
3154+
3155+
capprops : dict or None (default)
3156+
If provided, will set the plotting style of the caps
3157+
3158+
flierprops : dict or None (default)
3159+
If provided, will set the plotting style of the fliers
3160+
3161+
medianprops : dict or None (default)
3162+
If provided, will set the plotting style of the medians
3163+
3164+
meanprops : dict or None (default)
31663165
If provided, will set the plotting style of the means
31673166
3168-
meanline : bool, default = False
3167+
meanline : bool, default = False
31693168
If True (and *showmeans* is True), will try to render the mean
31703169
as a line spanning the full width of the box according to
31713170
*meanprops*. Not recommended if *shownotches* is also True.
31723171
Otherwise, means will be shown as points.
31733172
3174-
manage_xticks : bool, default = True
3173+
manage_xticks : bool, default = True
31753174
If the function should adjust the xlim and xtick locations.
31763175
31773176
Returns
@@ -4977,7 +4976,7 @@ def _pcolorargs(funcname, *args, **kw):
49774976
allmatch = kw.pop("allmatch", False)
49784977

49794978
if len(args) == 1:
4980-
C = args[0]
4979+
C = np.asanyarray(args[0])
49814980
numRows, numCols = C.shape
49824981
if allmatch:
49834982
X, Y = np.meshgrid(np.arange(numCols), np.arange(numRows))
@@ -4987,7 +4986,7 @@ def _pcolorargs(funcname, *args, **kw):
49874986
return X, Y, C
49884987

49894988
if len(args) == 3:
4990-
X, Y, C = args
4989+
X, Y, C = [np.asanyarray(a) for a in args]
49914990
numRows, numCols = C.shape
49924991
else:
49934992
raise TypeError(

lib/matplotlib/tests/test_axes.py

+15
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,21 @@ def test_symlog2():
738738
ax.set_ylim(-0.1, 0.1)
739739

740740

741+
@cleanup
742+
def test_pcolorargs():
743+
# Smoketest to catch issue found in gh:5205
744+
x = [-1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5]
745+
y = [-1.5, -1.25, -1.0, -0.75, -0.5, -0.25, 0,
746+
0.25, 0.5, 0.75, 1.0, 1.25, 1.5]
747+
X, Y = np.meshgrid(x, y)
748+
Z = np.hypot(X, Y)
749+
750+
plt.pcolor(Z)
751+
plt.pcolor(list(Z))
752+
plt.pcolor(x, y, Z)
753+
plt.pcolor(X, Y, list(Z))
754+
755+
741756
@image_comparison(baseline_images=['pcolormesh'], remove_text=True)
742757
def test_pcolormesh():
743758
n = 12

0 commit comments

Comments
 (0)