66from matplotlib .externals .six import unichr
77
88import os , base64 , tempfile , gzip , io , sys , codecs , re
9+ from collections import OrderedDict
910
1011import numpy as np
1112
@@ -263,15 +264,15 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
263264 assert basename is not None
264265 self .basename = basename
265266 self ._imaged = {}
266- self ._clipd = {}
267+ self ._clipd = OrderedDict ()
267268 self ._char_defs = {}
268269 self ._markers = {}
269270 self ._path_collection_id = 0
270271 self ._imaged = {}
271- self ._hatchd = {}
272+ self ._hatchd = OrderedDict ()
272273 self ._has_gouraud = False
273274 self ._n_gradients = 0
274- self ._fonts = {}
275+ self ._fonts = OrderedDict ()
275276 self .mathtext_parser = MathTextParser ('SVG' )
276277
277278 RendererBase .__init__ (self )
@@ -1087,7 +1088,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
10871088
10881089 # Sort the characters by font, and output one tspan for
10891090 # each
1090- spans = {}
1091+ spans = OrderedDict ()
10911092 for font , fontsize , thetext , new_x , new_y , metrics in svg_glyphs :
10921093 style = generate_css ({
10931094 'font-size' : six .text_type (fontsize ) + 'px' ,
@@ -1103,7 +1104,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
11031104 fontset = self ._fonts .setdefault (font .fname , set ())
11041105 fontset .add (thetext )
11051106
1106- for style , chars in list ( six .iteritems (spans ) ):
1107+ for style , chars in six .iteritems (spans ):
11071108 chars .sort ()
11081109
11091110 same_y = True
0 commit comments