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

Skip to content

Commit 29b593f

Browse files
committed
Fix images with "none" interpolation in the SVG backend. Inkscape doesn't like images with negative dimensions, so change to positive and adjust the offset accordingly.
1 parent 6923c7f commit 29b593f

File tree

2 files changed

+85
-84
lines changed

2 files changed

+85
-84
lines changed

lib/matplotlib/backends/backend_svg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,12 @@ def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None):
764764
width=str(w), height=str(h),
765765
attrib=attrib)
766766
else:
767+
flipped = self._make_flip_transform(transform)
767768
attrib['transform'] = generate_transform(
768-
[('matrix', transform.to_values())])
769+
[('matrix', flipped.to_values())])
769770
self.writer.element(
770771
'image',
771-
x=str(x), y=str(y), width=str(dx), height=str(dy),
772+
x=str(x), y=str(y+dy), width=str(dx), height=str(-dy),
772773
attrib=attrib)
773774

774775
if url is not None:

0 commit comments

Comments
 (0)