Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88435bc

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 04937b5 commit 88435bc

13 files changed

Lines changed: 182 additions & 26 deletions

lib/matplotlib/axes/_axes.py

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

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

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

30323034
if not self._hold:
@@ -3077,15 +3079,16 @@ def dopatch(xs, ys, **kwargs):
30773079
stats['q1']]
30783080
med_x = [box_left, box_right]
30793081

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

30903093
# draw the whiskers
30913094
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)