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

Skip to content

Commit a054987

Browse files
committed
[2832896] raster scale error in PDF, EPS output
svn path=/trunk/matplotlib/; revision=7614
1 parent 74afc2e commit a054987

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

lib/matplotlib/backends/backend_agg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath):
140140
# space) in the following call to draw_text_image).
141141
font.set_text(s, 0, flags=LOAD_FORCE_AUTOHINT)
142142
font.draw_glyphs_to_bitmap()
143-
143+
144144
#print x, y, int(x), int(y), s
145145

146146
self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, angle, gc)

lib/matplotlib/image.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def draw(self, renderer, *args, **kwargs):
141141
gc = renderer.new_gc()
142142
gc.set_clip_rectangle(self.axes.bbox.frozen())
143143
gc.set_clip_path(self.get_clip_path())
144-
renderer.draw_image(gc, round(l), round(b), im)
144+
renderer.draw_image(gc, l, b, im)
145145

146146
def contains(self, mouseevent):
147147
"""
@@ -421,10 +421,8 @@ def make_image(self, magnification=1.0):
421421
ty = (ymin-self.axes.viewLim.y0)/dyintv * numrows
422422

423423
l, b, r, t = self.axes.bbox.extents
424-
widthDisplay = (round(r) + 0.5) - (round(l) - 0.5)
425-
heightDisplay = (round(t) + 0.5) - (round(b) - 0.5)
426-
widthDisplay *= magnification
427-
heightDisplay *= magnification
424+
widthDisplay = (round(r*magnification) + 0.5) - (round(l*magnification) - 0.5)
425+
heightDisplay = (round(t*magnification) + 0.5) - (round(b*magnification) - 0.5)
428426
im.apply_translation(tx, ty)
429427

430428
# resize viewport to display

src/_backend_agg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,8 @@ RendererAgg::draw_image(const Py::Tuple& args) {
803803
args.verify_length(4);
804804

805805
GCAgg gc(args[0], dpi);
806-
double x = Py::Float(args[1]);
807-
double y = Py::Float(args[2]);
806+
double x = mpl_round(Py::Float(args[1]));
807+
double y = mpl_round(Py::Float(args[2]));
808808
Image *image = static_cast<Image*>(args[3].ptr());
809809
bool has_clippath = false;
810810

0 commit comments

Comments
 (0)