-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
NonUniformImage does not respond to ax.set_scale('log') #13442
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
Comments
What are you trying to do with |
Thanks for your answer.
I was not aware of Anyways, the point is that |
#9629 does what you want with Skeptical that anyone will get |
Alright, thanks for the reference and help. |
You're welcome to keep this open - maybe someone else thinks |
Done! Thanks again. |
This bug is shared by the |
I think the patch to fix this is along the lines of diff --git i/lib/matplotlib/image.py w/lib/matplotlib/image.py
index a7642a2cb2..ec585e329c 100644
--- i/lib/matplotlib/image.py
+++ w/lib/matplotlib/image.py
@@ -1066,8 +1066,10 @@ class NonUniformImage(AxesImage):
l, b, r, t = self.axes.bbox.extents
width = int(((round(r) + 0.5) - (round(l) - 0.5)) * magnification)
height = int(((round(t) + 0.5) - (round(b) - 0.5)) * magnification)
- x_pix = np.linspace(vl.x0, vl.x1, width)
- y_pix = np.linspace(vl.y0, vl.y1, height)
+ x_pix, _ = self.axes.get_xaxis_transform().inverted().transform(
+ np.column_stack([np.linspace(l, r, width), np.zeros(width)])).T
+ _, y_pix = self.axes.get_yaxis_transform().inverted().transform(
+ np.column_stack([np.zeros(height), np.linspace(b, t, height)])).T
if self._interpolation == "nearest":
x_mid = (self._Ax[:-1] + self._Ax[1:]) / 2
y_mid = (self._Ay[:-1] + self._Ay[1:]) / 2 (i.e. just get the data coordinates corresponding to pixel values). There may just be some off-by-1 or off-by-0.5 things... |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Bug report
Bug summary
An image displayed with NonUniformImage does not respond to scaling the axis with
ax.set_xscale('log')
, other than changing the axis, not the image itself.Code for reproduction
Actual outcome
Expected outcome
The bottom panels are made using NonUniformImage. I expected a change similar to the top two panels (made with imshow) when setting
ax.set_xscale('log')
, however as can be seen in the bottom two panels, the image does not change from the left to the right hand side, only the axis.The issue is briefly discussed in this link, and suggested by stackoverflow user Aaron to originate from the following:
Matplotlib version
print(matplotlib.get_backend())
): Qt5AggPython installed via default conda channel
The text was updated successfully, but these errors were encountered: