how can I adjust the dimension of the graphic window?
2 views (last 30 days)
Show older comments
I have this problem: I've used the gui of Mathlab in my university to adorn my graphic window with graphics, images and comments in a easy way, but at home the result is horrible becuse of the different size of the monitor (pieces of the images and comments are cutten off the window).
The most of the code is the following:
This is the code I've written for the main programm
if true
%%Variabili
L=256;
Lmin=0;
Lmax=255;
gamma=2.5;
setappdata(0,'some_Lmin',Lmin)
setappdata(0,'some_Lmax',Lmax)
%%Read
nike_int=imread('nike_bw.jpg');
nike=cast(nike_int, 'double');
%%Original Image
setappdata(0,'some_var',nike)
%%Trasformazione negativa su nike_bw.jpg
nike_negativa=-nike + (L-1)*ones(size(nike));
setappdata(0,'some_var2',nike_negativa)
Figure1();
end
and this is the part I've modified in the function called Figure1, tha I have obtained with the gui:
if true
some_other_Lmin = getappdata(0,'some_Lmin');
some_other_Lmax = getappdata(0,'some_Lmax');
some_other_var = getappdata(0,'some_var');
axes(handles.axes1);
imagesc(some_other_var, [some_other_Lmin, some_other_Lmax]);
colormap gray;
axis off;
axis equal;
title('IMMAGINE ORIGINALE', 'FontWeight','bold');
some_other_var2 = getappdata(0,'some_var2');
axes(handles.axes2);
imagesc(some_other_var2, [some_other_Lmin, some_other_Lmax]);
colormap gray;
axis off;
axis equal;
title('IMMAGINE IN NEGATIVO', 'FontWeight','bold');
end
0 Comments
Answers (3)
Chad Greene
on 21 Mar 2015
set(gcf,'pos',[100 150 1200 800]) sets a 1200 pixel wide by 800 pixel tall figure, with its lower left corner at x = 100 pixels and y = 150 pixels.
2 Comments
Stephen23
on 21 Mar 2015
@Andrea Raffo: you can read about all of the figure properties and change them using the method Chad Greene has shown. As well as the Position property you might also be interested in the OuterPosition and Units properties.
Image Analyst
on 21 Mar 2015
Make sure all the 'units' properties of your controls are set to 'normalized'. Then put this somewhere, like in the openingfcn() function:
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
Stephen23
on 22 Mar 2015
Edited: Stephen23
on 23 Mar 2015
It is likely that the multiple monitors are causing the confusion. There is no simple solution with using multiple monitors except to:
- get the positions of all of the monitors and then
- use one of these to explicitly set the figure position.
You should carefully read this documentation:
and use get to retrieve either the MonitorPositions or ScreenSize property to get the monitor position/s. Note that you will also need to pay careful attention to the Units property: pixels is probably the most reliable to work with. You can then set calculate the desired figure position (and size) from this value, and set the appropriate figure property.
These might be of interest too:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!