Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

SVG flip issue #1689

Closed
tkanmae opened this Issue · 2 comments

2 participants

@tkanmae

#1674 is not entirely fixed. I got a flipped svg using imshow() with origin='lower'. The snippet at the bottom reproduces the issue with the current master branch. This problem was introduced between v1.1.1 and v1.2.0rc3.

I dug the issue a bit deeper, and found that 1c9f9b5 introduced the issue. The commit seems a performance tweak for nearest neighbor scaling in a certain condition. Reverting 1c9f9b5 and 8c25664 fixes the issue.

I suggest to revert both commits, but to keep the test cases introduced in 8c25664. @mdboom, is this ok for you to revert 1c9f9b5 for now?

import matplotlib.pyplot as plt
import numpy as np

# Use default configuration.
plt.matplotlib.rcdefaults()

# Data
X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
Z = np.sin(Y**2)

plt.rcParams['svg.image_noscale'] = False
plt.figure()
plt.imshow(Z, cmap='gray', origin='upper')
plt.savefig('upper.svg')

plt.rcParams['svg.image_noscale'] = True
plt.figure()
plt.imshow(Z, cmap='gray', origin='upper')
plt.savefig('upper_noscale.svg')

plt.rcParams['svg.image_noscale'] = False
plt.figure()
plt.imshow(Z, cmap='gray', origin='lower')
plt.savefig('lower.svg')

plt.rcParams['svg.image_noscale'] = True
plt.figure()
plt.imshow(Z, cmap='gray', origin='lower')
plt.savefig('lower_noscale.svg')
@dmcdougall
Collaborator

Thank @tkanmae for bringing this up again. I should have git bisected from the outset rather than fiddling with the SVG backend. Sorry for the wild goose chase.

I think your proposed solution of reverting 1c9f9b5 and doing a partial revert of 8c25664, keeping only the test cases, is the best option, provided all the tests pass after these changes.

See #1691 for the PR.

@tkanmae

Thanks. Looks good to me.

@tkanmae tkanmae closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.