Skip to content
Merged
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
1 change: 0 additions & 1 deletion lib/matplotlib/legend_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,6 @@ def get_first(prop_array):
legend_handle.set_linewidth(get_first(orig_handle.get_linewidths()))
legend_handle.set_linestyle(get_first(orig_handle.get_linestyles()))
legend_handle.set_transform(get_first(orig_handle.get_transforms()))
legend_handle.set_figure(orig_handle.get_figure())
# Alpha is already taken into account by the color attributes.

def create_artists(self, legend, orig_handle,
Expand Down
14 changes: 14 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3420,6 +3420,20 @@ def test_stackplot_hatching(fig_ref, fig_test):
ax_ref.set_ylim(0, 70)


def test_stackplot_subfig_legend():
# Smoke test for https://github.com/matplotlib/matplotlib/issues/30158

fig = plt.figure()
subfigs = fig.subfigures(nrows=1, ncols=2)

for _fig in subfigs:
ax = _fig.subplots(nrows=1, ncols=1)
ax.stackplot([3, 4], [[1, 2]], labels=['a'])

fig.legend()
fig.draw_without_rendering()


def _bxp_test_helper(
stats_kwargs={}, transform_stats=lambda s: s, bxp_kwargs={}):
np.random.seed(937)
Expand Down
Loading