Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix figure legend when drawing stackplots#30186

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 2 commits intomatplotlib:mainfromdstansby:fig-legend-error
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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 deletionlib/matplotlib/legend_handler.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionslib/matplotlib/tests/test_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp