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 f435941

Browse filesBrowse files
committed
API: do not truncate the total size of svg element to integers
closes #9815
1 parent 2fd479a commit f435941
Copy full SHA for f435941

File tree

Expand file treeCollapse file tree

2 files changed

+11
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-3
lines changed
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Do not truncate svg sizes to nearest point
2+
------------------------------------------
3+
4+
There is no reason to size the SVG out put in integer points, change
5+
to out putting floats for the *height*, *width*, and *viewBox* attributes
6+
of the *svg* element.

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,14 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
285285

286286
RendererBase.__init__(self)
287287
self._glyph_map = dict()
288-
288+
str_height = short_float_fmt(height)
289+
str_width = short_float_fmt(width)
289290
svgwriter.write(svgProlog)
290291
self._start_id = self.writer.start(
291292
'svg',
292-
width='%ipt' % width, height='%ipt' % height,
293-
viewBox='0 0 %i %i' % (width, height),
293+
width='%spt' % str_width,
294+
height='%spt' % str_height,
295+
viewBox='0 0 %s %s' % (str_width, str_height),
294296
xmlns="http://www.w3.org/2000/svg",
295297
version="1.1",
296298
attrib={'xmlns:xlink': "http://www.w3.org/1999/xlink"})

0 commit comments

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