Skip to content

Commit bba6eea

Browse files
committed
Merge pull request #1800 from mdboom/agg_snapping2
Agg snapping fixes (for the last time...?) :)
2 parents c7da07d + 8fe199b commit bba6eea

File tree

430 files changed

+46
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

430 files changed

+46
-10
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
154154
ox, oy, width, height, descent, font_image, used_characters = \
155155
self.mathtext_parser.parse(s, self.dpi, prop)
156156

157-
x = int(x) + ox
158-
y = int(y) - oy
157+
x = np.round(x + ox)
158+
y = np.round(y - oy)
159159
self._renderer.draw_text_image(font_image, x, y + 1, angle, gc)
160160

161161
def draw_text(self, gc, x, y, s, prop, angle, ismath):
@@ -179,7 +179,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath):
179179
font.draw_glyphs_to_bitmap(antialiased=rcParams['text.antialiased'])
180180

181181
#print x, y, int(x), int(y), s
182-
self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, angle, gc)
182+
self._renderer.draw_text_image(
183+
font.get_image(), np.round(x), np.round(y) + 1, angle, gc)
183184

184185
def get_text_width_height_descent(self, s, prop, ismath):
185186
"""

0 commit comments

Comments
 (0)