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

Commit99b4ee3

Browse files
authored
Merge pull request#30186 from dstansby/fig-legend-error
Fix figure legend when drawing stackplots
2 parents947590d +b370e30 commit99b4ee3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

‎lib/matplotlib/legend_handler.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,6 @@ def get_first(prop_array):
799799
legend_handle.set_linewidth(get_first(orig_handle.get_linewidths()))
800800
legend_handle.set_linestyle(get_first(orig_handle.get_linestyles()))
801801
legend_handle.set_transform(get_first(orig_handle.get_transforms()))
802-
legend_handle.set_figure(orig_handle.get_figure())
803802
# Alpha is already taken into account by the color attributes.
804803

805804
defcreate_artists(self,legend,orig_handle,

‎lib/matplotlib/tests/test_axes.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,6 +3420,20 @@ def test_stackplot_hatching(fig_ref, fig_test):
34203420
ax_ref.set_ylim(0,70)
34213421

34223422

3423+
deftest_stackplot_subfig_legend():
3424+
# Smoke test for https://github.com/matplotlib/matplotlib/issues/30158
3425+
3426+
fig=plt.figure()
3427+
subfigs=fig.subfigures(nrows=1,ncols=2)
3428+
3429+
for_figinsubfigs:
3430+
ax=_fig.subplots(nrows=1,ncols=1)
3431+
ax.stackplot([3,4], [[1,2]],labels=['a'])
3432+
3433+
fig.legend()
3434+
fig.draw_without_rendering()
3435+
3436+
34233437
def_bxp_test_helper(
34243438
stats_kwargs={},transform_stats=lambdas:s,bxp_kwargs={}):
34253439
np.random.seed(937)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp