DEED
DEED

Reputation: 63

Draw on figure too large for screen?

I have an 800x800 double matrix that I need to draw little red dots on. I tried converting it to an image with mat2gray(array,[0,1]), but matlab scales it by 67% before it draws to my screen. That means I can't use plot(x,y,'r') to draw the little dots.

I have tried looking into overlaying images, making the figure invisible, etc, but I can't figure out how to do this. There must be a simple way. Any ideas?

Here is my current code:

%map is an 800x800 matrix of doubles
img = mat2gray(map,[0,1]);

hold on;
plot(point.x, point.y,'r.','MarkerSize',10);
hold off

img = imresize(img,0.66); %so that matlab doesn't yell at me
set(figHandle, 'visible','on');
imshow(img);

Upvotes: 1

Views: 328

Answers (1)

Noel Segura Meraz
Noel Segura Meraz

Reputation: 2323

The warning Matlab gives when plotting an image bigger than the window size

Warning: Image is too big to fit on screen; displaying at 67%

Does not mean that it changes the size of your array or image. It means that it plot it at normal size and then zooms out that %. Your array is still 800x800. If you want to plot over it, the same x,y coordinates apply. For example

imshow(rand(1000))
% Warning: Image is too big to fit on screen; displaying at 67% 
%   In imuitools/private/initSize at 71
%   In imshow at 282 
hold on
plot(500,500,'r.','MarkerSize',100)

Will create this

enter image description here

As you can see, they red dot is in the middle of the image, as expected. You don't need to resize your image

Also in your case, if you plot first the points and then the image, the image will be displayed above the points, covering them, I suggest first plotting the image, and then the points.

Upvotes: 3

Related Questions