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

Skip to content

NonUniformImage wrong image when using large values for axis #15039

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

Closed
funkygoby opened this issue Aug 12, 2019 · 2 comments · Fixed by #14913
Closed

NonUniformImage wrong image when using large values for axis #15039

funkygoby opened this issue Aug 12, 2019 · 2 comments · Fixed by #14913

Comments

@funkygoby
Copy link

When using matplotlib.image.NonUniformImage with large values on axis (~10e+7), the plot breaks.

I am plotting a random matrix and simply offsetting the axis by with a large value:

Normal behaviour
ok

Strange behaviour
not_ok

The code

import numpy
import matplotlib.pyplot as plt
from matplotlib.image import NonUniformImage

offset = 9.*10**6 # XXX change this XXX
nx = 60
ny = 100
x = numpy.arange(offset, offset+nx)
y = numpy.arange(offset, offset+ny)
z = numpy.random.rand(ny, nx)

ax = plt.subplot(111)
im = NonUniformImage(ax, extent=(offset, offset+nx, offset, offset+ny))
im.set_data(x, y, z)
ax.images.append(im)
ax.set_xlim(offset, offset+nx)
ax.set_ylim(offset, offset+ny)

plt.show()

By changing the offset variable, one can achieve different results: 1. is ok; 9. is broken.

Thank you

@timhoffm
Copy link
Member

Confirmed on master.

Observation: The result depends on the figsize:

grafik
grafik
grafik
grafik
grafik

Probably there is some kind of coordinate to data index mapping problem.

@anntzer
Copy link
Contributor

anntzer commented May 20, 2020

This appears to be fixed by #14913 (and it's not "just" a naive precision problem -- replacing floats by doubles everywhere in the c++ code doesn't seem enough to fix it.

@QuLogic QuLogic added this to the v3.5.0 milestone May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants