diff --git a/lib/matplotlib/backends/backend_svg.py b/lib/matplotlib/backends/backend_svg.py index e0a2daedae05..5e45a24f22d1 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 these 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)
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: