Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10145a2

Browse files
committed
Don't sort lexicographially entries in SVG output.
Sorting had been added in cb5893d for reproducible outputs, but dicts now maintain insertion order so this is not needed anymore; moreover, not sorting allows keeping attributes in a more semantic meaning -- e.g., attributes of the toplevel `<svg>` are now in the order `xmlns:xlink width height viewBox xmlns version` rather than `height version viewBox width xmlns xmlns:xlink`; the `<use>` elements of ticks now have attributes `xlink:href x y style` rather than `style x xlink:href y`. The order is still not perfect due to other issues, but that'll be addressed another time.
1 parent 200ebe1 commit 10145a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/backends/backend_svg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def start(self, tag, attrib={}, **extra):
156156
self.__tags.append(tag)
157157
self.__write(self.__indentation[:len(self.__tags) - 1])
158158
self.__write("<%s" % tag)
159-
for k, v in sorted({**attrib, **extra}.items()):
159+
for k, v in {**attrib, **extra}.items():
160160
if v:
161161
k = escape_cdata(k)
162162
v = escape_attrib(v)
@@ -264,7 +264,7 @@ def generate_transform(transform_list=[]):
264264
def generate_css(attrib={}):
265265
if attrib:
266266
output = StringIO()
267-
attrib = sorted(attrib.items())
267+
attrib = attrib.items()
268268
for k, v in attrib:
269269
k = escape_attrib(k)
270270
v = escape_attrib(v)

0 commit comments

Comments
 (0)