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 4d78ae6

Browse filesBrowse files
committed
STY: StringIO instead of BytesIO in svg examples
As svg is a string format, use `StringIO` as the temporary buffer in svg examples.
1 parent 6461fd9 commit 4d78ae6
Copy full SHA for 4d78ae6

File tree

Expand file treeCollapse file tree

4 files changed

+8
-8
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+8
-8
lines changed

‎examples/misc/svg_filter_line.py

Copy file name to clipboardExpand all lines: examples/misc/svg_filter_line.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
ax.set_ylim(0., 1.)
5353

5454
# save the figure as a string in the svg format.
55-
from io import BytesIO
56-
f = BytesIO()
55+
from io import StringIO
56+
f = StringIO()
5757
plt.savefig(f, format="svg")
5858

5959

‎examples/misc/svg_filter_pie.py

Copy file name to clipboardExpand all lines: examples/misc/svg_filter_pie.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242

4343

4444
# save
45-
from io import BytesIO
46-
f = BytesIO()
45+
from io import StringIO
46+
f = StringIO()
4747
plt.savefig(f, format="svg")
4848

4949
import xml.etree.cElementTree as ET

‎examples/user_interfaces/svg_histogram.py

Copy file name to clipboardExpand all lines: examples/user_interfaces/svg_histogram.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import numpy as np
3636
import matplotlib.pyplot as plt
3737
import xml.etree.ElementTree as ET
38-
from io import BytesIO
38+
from io import StringIO
3939
import json
4040

4141
plt.rcParams['svg.embed_char_paths'] = 'none'
@@ -76,7 +76,7 @@
7676
t.set_gid('leg_text_%d' % i)
7777

7878
# Save SVG in a fake file object.
79-
f = BytesIO()
79+
f = StringIO()
8080
plt.savefig(f, format="svg")
8181

8282
# Create XML tree from the SVG file.

‎examples/user_interfaces/svg_tooltip.py

Copy file name to clipboardExpand all lines: examples/user_interfaces/svg_tooltip.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import matplotlib.pyplot as plt
2626
import xml.etree.ElementTree as ET
27-
from io import BytesIO
27+
from io import StringIO
2828

2929
ET.register_namespace("", "http://www.w3.org/2000/svg")
3030

@@ -72,7 +72,7 @@
7272
ax.set_ylim(-30, 30)
7373
ax.set_aspect('equal')
7474

75-
f = BytesIO()
75+
f = StringIO()
7676
plt.savefig(f, format="svg")
7777

7878
# --- Add interactivity ---

0 commit comments

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