Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG flip issue #1689

Closed
tkanmae opened this issue Jan 20, 2013 · 2 comments
Closed

SVG flip issue #1689

tkanmae opened this issue Jan 20, 2013 · 2 comments

Comments

@tkanmae
Copy link
Contributor

tkanmae commented Jan 20, 2013

#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
Copy link
Member

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
Copy link
Contributor Author

tkanmae commented Jan 21, 2013

Thanks. Looks good to me.

@tkanmae tkanmae closed this as completed Jan 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants