From b827d478bf76279f4abc247ecc1964ca2f248188 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 6 Oct 2018 22:56:50 +0200 Subject: [PATCH 1/2] Minor simplifications to backend_svg. --- lib/matplotlib/backends/backend_svg.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/matplotlib/backends/backend_svg.py b/lib/matplotlib/backends/backend_svg.py index e0a2daedae05..4af66accbf00 100644 --- a/lib/matplotlib/backends/backend_svg.py +++ b/lib/matplotlib/backends/backend_svg.py @@ -1,5 +1,4 @@ from collections import OrderedDict - import base64 import gzip import hashlib @@ -155,7 +154,7 @@ def start(self, tag, attrib={}, **extra): if not v == '': k = escape_cdata(k) v = escape_attrib(v) - self.__write(" %s=\"%s\"" % (k, v)) + self.__write(' %s="%s"' % (k, v)) self.__open = 1 return len(self.__tags)-1 @@ -1005,9 +1004,8 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None): glyph_info, glyph_map_new, rects = _glyphs - # we store the character glyphs w/o flipping. Instead, the - # coordinate will be flipped when this characters are - # used. + # We store the character glyphs w/o flipping. Instead, the + # coordinate will be flipped when this characters are used. if glyph_map_new: writer.start('defs') for char_id, glyph_path in glyph_map_new.items(): @@ -1161,14 +1159,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None): for style, chars in spans.items(): chars.sort() - same_y = True - if len(chars) > 1: - last_y = chars[0][1] - for i in range(1, len(chars)): - if chars[i][1] != last_y: - same_y = False - break - if same_y: + if len({y for x, y, t in chars}) == 1: # Are all y's the same? ys = str(chars[0][1]) else: ys = ' '.join(str(c[1]) for c in chars) From ce0519ab4eca013f3ff087f9fd540043962b5ca2 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Sat, 6 Oct 2018 15:40:51 -0700 Subject: [PATCH 2/2] Fix typo --- lib/matplotlib/backends/backend_svg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_svg.py b/lib/matplotlib/backends/backend_svg.py index 4af66accbf00..5e45a24f22d1 100644 --- a/lib/matplotlib/backends/backend_svg.py +++ b/lib/matplotlib/backends/backend_svg.py @@ -1005,7 +1005,7 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None): glyph_info, glyph_map_new, rects = _glyphs # We store the character glyphs w/o flipping. Instead, the - # coordinate will be flipped when this characters are used. + # coordinate will be flipped when these characters are used. if glyph_map_new: writer.start('defs') for char_id, glyph_path in glyph_map_new.items(): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy