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

Appearance settings

Commit 6a5aa01

Browse filesBrowse files
committed
Merge pull request #2415 from kshramt/kshramt/fix_fill_opacity
Bug: alpha parameter was ignored when fill color is #000000
2 parents 9804c5d + 78ae9d7 commit 6a5aa01
Copy full SHA for 6a5aa01

File tree

Expand file treeCollapse file tree

3 files changed

+298
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+298
-2
lines changed

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,9 @@ def _get_style_dict(self, gc, rgbFace):
406406
else:
407407
if rgbFace is None:
408408
attrib['fill'] = 'none'
409-
elif tuple(rgbFace[:3]) != (0, 0, 0):
410-
attrib['fill'] = rgb2hex(rgbFace)
409+
else:
410+
if tuple(rgbFace[:3]) != (0, 0, 0):
411+
attrib['fill'] = rgb2hex(rgbFace)
411412
if len(rgbFace) == 4 and rgbFace[3] != 1.0 and not forced_alpha:
412413
attrib['fill-opacity'] = str(rgbFace[3])
413414

+287Lines changed: 287 additions & 0 deletions
Loading

‎lib/matplotlib/tests/test_backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_svg.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def test_visibility():
3636
parser.Parse(buf) # this will raise ExpatError if the svg is invalid
3737

3838

39+
@image_comparison(baseline_images=['fill_black_with_alpha'], remove_text=True,
40+
extensions=['svg'])
41+
def test_fill_black_with_alpha():
42+
fig = plt.figure()
43+
ax = fig.add_subplot(1, 1, 1)
44+
ax.scatter(x=[0, 0.1, 1], y=[0, 0, 0], c='k', alpha=0.1, s=10000)
45+
46+
3947
@image_comparison(baseline_images=['noscale'], remove_text=True)
4048
def test_noscale():
4149
X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.