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

Commitbae7631

Browse files
authored
Merge pull request#29006 from QuLogic/auto-backport-of-pr-28993-on-v3.9.x
Backport PR#28993 on branch v3.9.x (FIX: contourf hatches use multiple edgecolors)
2 parentscbebc61 +7b547ea commitbae7631

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

‎lib/matplotlib/contour.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,12 +1415,16 @@ def draw(self, renderer):
14151415
super().draw(renderer)
14161416
return
14171417
# In presence of hatching, draw contours one at a time.
1418+
edgecolors=self.get_edgecolors()
1419+
ifedgecolors.size==0:
1420+
edgecolors= ("none",)
14181421
foridxinrange(n_paths):
14191422
withcbook._setattr_cm(self,_paths=[paths[idx]]),self._cm_set(
14201423
hatch=self.hatches[idx%len(self.hatches)],
14211424
array=[self.get_array()[idx]],
14221425
linewidths=[self.get_linewidths()[idx%len(self.get_linewidths())]],
14231426
linestyles=[self.get_linestyles()[idx%len(self.get_linestyles())]],
1427+
edgecolors=edgecolors[idx%len(edgecolors)],
14241428
):
14251429
super().draw(renderer)
14261430

‎lib/matplotlib/tests/test_contour.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ def test_given_colors_levels_and_extends(split_collections):
198198
_maybe_split_collections(split_collections)
199199

200200

201+
@image_comparison(['contourf_hatch_colors'],
202+
remove_text=True,style='mpl20',extensions=['png'])
203+
deftest_hatch_colors():
204+
fig,ax=plt.subplots()
205+
cf=ax.contourf([[0,1], [1,2]],hatches=['-','/','\\','//'],cmap='gray')
206+
cf.set_edgecolors(["blue","grey","yellow","red"])
207+
208+
201209
@pytest.mark.parametrize("split_collections", [False,True])
202210
@image_comparison(['contour_log_locator.svg'],style='mpl20',remove_text=False)
203211
deftest_log_locator_levels(split_collections):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp