imagesc is missing several rows of pixels when image has 1780 rows of pixel

4 views (last 30 days)
% 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
raym
raym on 26 Feb 2023
It is OK now.
I do not know what happened. Initially the bug was found in R2016a. I run the test code in R2017b and the tick is Ok.
Then I run in R2016a and found tick is also OK now.
The same file opened days ago in R2016a:
The same file opened just now in R2016a:
DGM
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.

Sign in to comment.

Answers (0)

Categories

Find more on Data Exploration 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!