imagesc is missing several rows of pixels when image has 1780 rows of pixel
Show older comments
% Simple demo to reproduce the bug.
% Purpose: show 2000x300 image by imagesc with yticklabel,
% then do "Y-only" zoom for fast free-hand eye-check of data quality in flexible Y ranges.
% Problem: imagesc shows misalignment with yticklabel in large images (2000X300)
% when doing Y-only zoom to a very high level.
% this may indicate missing of rows of pixles?
N = 2000;
A = rand(N,300);
imagesc(A)
set(gca,'YTick', 1:N,'YTickLabel',cellfun(@num2str,num2cell(1:N),'uni',0));
zoom yon
% then scrool to see

Hi,I am using imagesc to present the matrix data and need to view the details by Y-only zoom. When the number of row is not high, e.g., 300, after Y-only zoom I could see a perfect match of row of pixels with a ytick labelled. However, when the row numer is much higher as 1700, after Y-only zoom in the y-tick is ok, but the row of pixels does not match, as shown in image, It seems that several rows of pixels are lost in total, thus ytick is more dense than pixel rows. Is there a way to solve this problem? Thanks.
6 Comments
I'm more inclined to suspect that this has something to do with how the yticks are being set up.
% a test image
N = 100;
A = rand(N,10);
imagesc(A) % show it
yticks(1:N); % one tick per ypixel
ylim([20 30]) % zoom in on a small region
% a test image
N = 10000;
A = rand(N,10);
imagesc(A) % show it
yticks(1:N); % one tick per ypixel
ylim([20 30]) % zoom in on a small region
Perhaps you can put together a small working example which demonstrates the issue so that others can test it.
raym
on 26 Feb 2023
DGM
on 26 Feb 2023
That's weird. Maybe there were some stale changes to the figure from it having been used prior. Even though I always clear an existing figure with clf before starting to use it, I find that doesn't always reset all the properties.
Answers (0)
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



