FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Lower test tolerance by mdboom · Pull Request #5307 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
Format floats in a Python2/3 compatible way
  • Loading branch information
mdboom committed Dec 10, 2015
commit ee145440782da9eb4748fd10445e75e9f018f85e
20 changes: 10 additions & 10 deletions lib/matplotlib/backends/backend_svg.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def generate_transform(transform_list=[]):
if type == 'matrix' and isinstance(value, Affine2DBase):
value = value.to_values()

output.write('%s(%s)' % (type, ' '.join(str(x) for x in value)))
output.write('%s(%s)' % (type, ' '.join('%f' % x for x in value)))
return output.getvalue()
return ''

Expand Down Expand Up @@ -401,18 +401,18 @@ def _get_style_dict(self, gc, rgbFace):
if gc.get_hatch() is not None:
attrib['fill'] = "url(#%s)" % self._get_hatch(gc, rgbFace)
if rgbFace is not None and len(rgbFace) == 4 and rgbFace[3] != 1.0 and not forced_alpha:
attrib['fill-opacity'] = str(rgbFace[3])
attrib['fill-opacity'] = "%f" % rgbFace[3]
else:
if rgbFace is None:
attrib['fill'] = 'none'
else:
if tuple(rgbFace[:3]) != (0, 0, 0):
attrib['fill'] = rgb2hex(rgbFace)
if len(rgbFace) == 4 and rgbFace[3] != 1.0 and not forced_alpha:
attrib['fill-opacity'] = str(rgbFace[3])
attrib['fill-opacity'] = "%f" % rgbFace[3]

if forced_alpha and gc.get_alpha() != 1.0:
attrib['opacity'] = str(gc.get_alpha())
attrib['opacity'] = "%f" % gc.get_alpha()

offset, seq = gc.get_dashes()
if seq is not None:
Expand All @@ -424,9 +424,9 @@ def _get_style_dict(self, gc, rgbFace):
rgb = gc.get_rgb()
attrib['stroke'] = rgb2hex(rgb)
if not forced_alpha and rgb[3] != 1.0:
attrib['stroke-opacity'] = str(rgb[3])
attrib['stroke-opacity'] = "%f" % rgb[3]
if linewidth != 1.0:
attrib['stroke-width'] = str(linewidth)
attrib['stroke-width'] = "%f" % linewidth
if gc.get_joinstyle() != 'round':
attrib['stroke-linejoin'] = gc.get_joinstyle()
if gc.get_capstyle() != 'butt':
Expand Down Expand Up @@ -754,7 +754,7 @@ def draw_gouraud_triangle(self, gc, points, colors, trans):
'use',
attrib={'xlink:href': href,
'fill': rgb2hex(avg_color),
'fill-opacity': str(avg_color[-1])})
'fill-opacity': "%f" % avg_color[-1]})
for i in range(3):
writer.element(
'use',
Expand Down Expand Up @@ -840,7 +840,7 @@ def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None):

alpha = gc.get_alpha()
if alpha != 1.0:
attrib['opacity'] = str(alpha)
attrib['opacity'] = "%f" % alpha

attrib['id'] = oid

Expand Down Expand Up @@ -1046,8 +1046,8 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
'center': 'middle'}
style['text-anchor'] = ha_mpl_to_svg[mtext.get_ha()]

attrib['x'] = str(ax)
attrib['y'] = str(ay)
attrib['x'] = "%f" % ax
attrib['y'] = "%f" % ay
attrib['style'] = generate_css(style)
attrib['transform'] = "rotate(%f, %f, %f)" % (-angle, ax, ay)
writer.element('text', s, attrib=attrib)
Expand Down

Back | FazBrowse Home | New Git URL