Skip to content

Bug #4414 #6169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3147,16 +3147,16 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
If True produces boxes with the Patch artist

showmeans : bool, default = False
If True, will toggle one the rendering of the means
If True, will toggle on the rendering of the means

showcaps : bool, default = True
If True, will toggle one the rendering of the caps
If True, will toggle on the rendering of the caps

showbox : bool, default = True
If True, will toggle one the rendering of box
If True, will toggle on the rendering of the box

showfliers : bool, default = True
If True, will toggle one the rendering of the fliers
If True, will toggle on the rendering of the fliers

boxprops : dict or None (default)
If provided, will set the plotting style of the boxes
Expand Down Expand Up @@ -3412,16 +3412,16 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
If `True`, will produce a notched box plot

showmeans : bool, default = False
If `True`, will toggle one the rendering of the means
If `True`, will toggle on the rendering of the means

showcaps : bool, default = True
If `True`, will toggle one the rendering of the caps
If `True`, will toggle on the rendering of the caps

showbox : bool, default = True
If `True`, will toggle one the rendering of box
If `True`, will toggle on the rendering of the box

showfliers : bool, default = True
If `True`, will toggle one the rendering of the fliers
If `True`, will toggle on the rendering of the fliers

boxprops : dict or None (default)
If provided, will set the plotting style of the boxes
Expand Down Expand Up @@ -6225,7 +6225,6 @@ def _normalize_input(inp, ename='input'):
# we return patches, so put it back in the expected order
patches.reverse()

# adopted from adjust_x/ylim part of the bar method
if orientation == 'horizontal':
xmin0 = max(_saved_bounds[0]*0.9, minimum)
xmax = self.dataLim.intervalx[1]
Expand All @@ -6237,16 +6236,22 @@ def _normalize_input(inp, ename='input'):
xmin = min(xmin0, xmin)
self.dataLim.intervalx = (xmin, xmax)
elif orientation == 'vertical':
ymin0 = max(_saved_bounds[1]*0.9, minimum)
ymax = self.dataLim.intervaly[1]

for m in n:
if np.sum(m) > 0: # make sure there are counts
ymin = np.amin(m[m != 0])
# filter out the 0 height bins
ymin = max(ymin*0.9, minimum) if not input_empty else minimum
ymin = min(ymin0, ymin)
self.dataLim.intervaly = (ymin, ymax)
# If norm, autoscale axis
if normed:
self.set_autoscaley_on(True)
else:
ymin0 = max(_saved_bounds[1]*0.9, minimum)
ymax = self.dataLim.intervaly[1]

for m in n:
if np.sum(m) > 0: # make sure there are counts
ymin = np.amin(m[m != 0])
# filter out the 0 height bins
ymin = max(ymin*0.9, minimum) if not input_empty else minimum
ymin = min(ymin0, ymin)
self.dataLim.intervaly = (ymin, ymax)


if label is None:
labels = [None]
Expand Down
15 changes: 15 additions & 0 deletions lib/matplotlib/tight_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,34 @@ def auto_adjust_subplotpars(fig, renderer,
if not margin_left:
margin_left = max([sum(s) for s in hspaces[::cols + 1]] + [0])
margin_left += pad_inches / fig_width_inch
# bugfix for bug-#5456
# simple check for the error
if margin_left > 0.5:
margin_left = 0.05

if not margin_right:
margin_right = max([sum(s) for s in hspaces[cols::cols + 1]] + [0])
margin_right += pad_inches / fig_width_inch
# bugfix for bug-#5456
# simple check for the error
if margin_right > 0.5:
margin_right = 0.05

if not margin_top:
margin_top = max([sum(s) for s in vspaces[:cols]] + [0])
margin_top += pad_inches / fig_height_inch
# bugfix for bug-#5456
if margin_top > 0.5:
margin_top = 0.05

if not margin_bottom:
margin_bottom = max([sum(s) for s in vspaces[-cols:]] + [0])
margin_bottom += pad_inches / fig_height_inch

# bugfix for bug-#5456
if margin_bottom > 0.5:
margin_bottom = 0.05

kwargs = dict(left=margin_left,
right=1 - margin_right,
bottom=margin_bottom,
Expand Down