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

Commitdb55918

Browse files
authored
Merge pull request#16890 from mnmelo/patch-1
Enables hatch alpha on SVG
2 parents0828170 +c939331 commitdb55918

File tree

3 files changed

+83
-74
lines changed

3 files changed

+83
-74
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The SVG backend can now render hatches with transparency
2+
--------------------------------------------------------
3+
4+
The SVG backend now respects the hatch stroke alpha. Useful applications are,
5+
among others, semi-transparent hatches as a subtle way to differentiate columns
6+
in bar plots.

‎lib/matplotlib/backends/backend_svg.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,16 +391,19 @@ def _write_hatches(self):
391391
x="0",y="0",width=str(HATCH_SIZE+1),
392392
height=str(HATCH_SIZE+1),
393393
fill=fill)
394-
writer.element(
395-
'path',
396-
d=path_data,
397-
style=generate_css({
394+
hatch_style= {
398395
'fill':rgb2hex(stroke),
399396
'stroke':rgb2hex(stroke),
400397
'stroke-width':str(mpl.rcParams['hatch.linewidth']),
401398
'stroke-linecap':'butt',
402399
'stroke-linejoin':'miter'
403-
})
400+
}
401+
ifstroke[3]<1:
402+
hatch_style['stroke-opacity']=str(stroke[3])
403+
writer.element(
404+
'path',
405+
d=path_data,
406+
style=generate_css(hatch_style)
404407
)
405408
writer.end('pattern')
406409
writer.end('defs')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp