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

Commit08169a9

Browse files
committed
Ensure URLs are stored for plain lines in SVG.
Fixes#17336.
1 parent3964f2a commit08169a9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

‎lib/matplotlib/lines.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ def draw(self, renderer):
761761
iflen(tpath.vertices):
762762
gc=renderer.new_gc()
763763
self._set_gc_clip(gc)
764+
gc.set_url(self.get_url())
764765

765766
lc_rgba=mcolors.to_rgba(self._color,self._alpha)
766767
gc.set_foreground(lc_rgba,isRGBA=True)
@@ -787,6 +788,7 @@ def draw(self, renderer):
787788
ifself._markerandself._markersize>0:
788789
gc=renderer.new_gc()
789790
self._set_gc_clip(gc)
791+
gc.set_url(self.get_url())
790792
gc.set_linewidth(self._markeredgewidth)
791793
gc.set_antialiased(self._antialiased)
792794

‎lib/matplotlib/tests/test_backend_svg.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,20 @@ def test_url():
220220
# Test that object url appears in output svg.
221221

222222
fig,ax=plt.subplots()
223+
224+
# collections
223225
s=ax.scatter([1,2,3], [4,5,6])
224226
s.set_urls(['http://example.com/foo','http://example.com/bar',None])
225227

228+
# Line2D
229+
p,=plt.plot([1,3], [6,5])
230+
p.set_url('http://example.com/baz')
231+
226232
b=BytesIO()
227233
fig.savefig(b,format='svg')
228234
b=b.getvalue()
229-
assertb'http://example.com/foo'inb
230-
assertb'http://example.com/bar'inb
235+
forvin [b'foo',b'bar',b'baz']:
236+
assertb'http://example.com/'+vinb
231237

232238

233239
deftest_url_tick():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp