8000 WIP: more tests and add option to toggle box · matplotlib/matplotlib@e9c1c9b · GitHub
[go: up one dir, main page]

Skip to content

Commit e9c1c9b

Browse files
committed
WIP: more tests and add option to toggle box
TST: added tests for all of bxp and more boxplot tests TST: fixed boxplot baseline image TST: added baseline images for bxp
1 parent 65a686c commit e9c1c9b

File tree

13 files changed

+182
-26
lines changed

13 files changed

+182
-26
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2927,7 +2927,7 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
29272927

29282928
def bxp(self, bxpstats, positions=None, widths=None, vert=True,
29292929
patch_artist=False, shownotches=False, showmeans=False,
2930-
showcaps=True, boxprops=None, flierprops=None,
2930+
showcaps=True, showbox=True, boxprops=None, flierprops=None,
29312931
medianprops=None, meanprops=None, meanline=False):
29322932

29332933
# lists of artists to be output
@@ -3025,7 +3025,9 @@ def dopatch(xs, ys, **kwargs):
30253025
if widths is None:
30263026
distance = max(positions) - min(positions)
30273027
widths = [min(0.15 * max(distance, 1.0), 0.5)] * N
3028-
elif len(widths) != len(bxpstats):
3028+
elif np.isscalar(widths):
3029+
widths = [widths] * N
3030+
elif len(widths) != N:
30293031
raise ValueError(datashape_message.format("widths"))
30303032

30313033
if not self._hold:
@@ -3076,15 +3078,16 @@ def dopatch(xs, ys, **kwargs):
30763078
stats['q1']]
30773079
med_x = [box_left, box_right]
30783080

3079-
# draw the box:
3080-
if patch_artist:
3081-
boxes.extend(dopatch(
3082-
box_x, box_y, **boxprops
3083-
))
3084-
else:
3085-
boxes.extend(doplot(
3086-
box_x, box_y, **boxprops
3087-
))
3081+
# maybe draw the box:
3082+
if showbox:
3083+
if patch_artist:
3084+
boxes.extend(dopatch(
3085+
box_x, box_y, **boxprops
3086+
))
3087+
else:
3088+
boxes.extend(doplot(
3089+
box_x, box_y, **boxprops
3090+
))
30883091

30893092
# draw the whiskers
30903093
whiskers.extend(doplot(
622 Bytes
Loading
3.14 KB
Loading
1.98 KB
Loading
3.87 KB
Loading
2 KB
Loading
2.19 KB
Loading
1.82 KB
Loading
1.87 KB
Loading
2 KB
Loading

0 commit comments

Comments
 (0)
0