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

Skip to content

Commit c48afe4

Browse files
committed
Fix a number of snapping issues. Incorporates ideas from matplotlib#800 (see there for further discussion) and matplotlib#1591. This, unlike matplotlib#800, doesn't change the snapping in a fundamental way, but it does help with text/image/marker alignment of snapped and non-snapped objects.
1 parent a6e7006 commit c48afe4

File tree

429 files changed

+15
-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.

429 files changed

+15
-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)