imagesc pixels unaligned with x axis for certain data sizes
40 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Charlie Black
el 12 de Nov. de 2024 a las 13:53
Comentada: Ashok
el 27 de Nov. de 2024 a las 3:38
Hello,
I am using imagesc to plot data (a 2D FFT). I found that when my data size is greater than 1024 indices, the pixel size does not match the x axis. Things look fine at a size of [3 1000] and [3 1024] but out of phase at [3 1025] and [3 1251]. This started after my workstation was updated to Win11. Prior to that, things worked fine no matter what the data size.
What could be causing this and does anyone know what a fix could be?
xleng = 1251;
figure
imagesc(rand([3 xleng]))
Below is an image with xlen set to 1000, showing the pixels in phase with the x axis
Below is an image with xlen set to 1251, showing the pixels out of phase with the x axis
Finally, here is a clip of my 2DFFT dataset, showing how the pixel bins are out of phase with size [360 1251]
3 comentarios
DGM
el 13 de Nov. de 2024 a las 2:30
This is grasping, but are you sure you don't have anything shadowing image() that might explain the slightly-off default XData?
Respuestas (1)
Ashok
el 25 de Nov. de 2024 a las 6:20
I could replicate the issue in R2021a but not in R2021b. Just a heads up, my current system runs Windows 11 and doesn't support hardware OpenGL.
Running the ‘opengl info’ command right after opening MATLAB gave these outputs:
R2021a:
R2021b:
As seen in the above images, the ‘HardwareSupportLevel’ is sometimes set to 'full' in R2021a even though the system doesn't support hardware OpenGL, leading to a similar issue.
Switching to software rendering by running the following command in the MATLAB command window seems to fix the rendering issue.
opengl software
Alternatively, one can start MATLAB with software OpenGL selected by running ‘matlab -softwareopengl’ in the windows command line. To save software OpenGL for future sessions, use the following command in the MATLAB command window.
opengl('save', 'software')
For more information on low-level graphics issues, check out this documentation page:
2 comentarios
Ashok
el 27 de Nov. de 2024 a las 3:38
Happy to know that the issue has been resolved and thanks for sharing the fix.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!