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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
OrderedDict instead of sorting
  • Loading branch information
klaus authored and mdboom committed Dec 10, 2015
commit 006f6ad82fcda820e31949f8910c0e9906fa29a8
11 changes: 6 additions & 5 deletions lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from matplotlib.externals.six import unichr

import os, base64, tempfile, gzip, io, sys, codecs, re
from collections import OrderedDict

import numpy as np

Expand Down Expand Up @@ -263,15 +264,15 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72):
assert basename is not None
self.basename = basename
self._imaged = {}
self._clipd = {}
self._clipd = OrderedDict()
self._char_defs = {}
self._markers = {}
self._path_collection_id = 0
self._imaged = {}
self._hatchd = {}
self._hatchd = OrderedDict()
self._has_gouraud = False
self._n_gradients = 0
self._fonts = {}
self._fonts = OrderedDict()
self.mathtext_parser = MathTextParser('SVG')

RendererBase.__init__(self)
Expand Down Expand Up @@ -1087,7 +1088,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):

# Sort the characters by font, and output one tspan for
# each
spans = {}
spans = OrderedDict()
for font, fontsize, thetext, new_x, new_y, metrics in svg_glyphs:
style = generate_css({
'font-size': six.text_type(fontsize) + 'px',
Expand All @@ -1103,7 +1104,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
fontset = self._fonts.setdefault(font.fname, set())
fontset.add(thetext)

for style, chars in list(six.iteritems(spans)):
for style, chars in six.iteritems(spans):
chars.sort()

same_y = True
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from matplotlib.font_manager import FontProperties, get_font
from matplotlib.transforms import Affine2D
from matplotlib.externals.six.moves.urllib.parse import quote as urllib_quote
from collections import OrderedDict


class TextToPath(object):
Expand Down Expand Up @@ -183,7 +184,7 @@ def get_glyphs_with_font(self, font, s, glyph_map=None,
glyph_map = dict()

if return_new_glyphs_only:
glyph_map_new = dict()
glyph_map_new = OrderedDict()
else:
glyph_map_new = glyph_map

Expand Down