|
"David Doria" <daviddoria@gmail.com> wrote in message
news:gcctti$58$1@fred.mathworks.com...
> sure sure, 4x as many pixels, i mean twice as many per dimension.
>
> So I've done something like this:
>
> spax1 = subplot(1,2,1); imshow(Original)
> spax2 = subplot(1,2,2);
> set(gca, 'position',[.1 .1 .8 .6]);
> imshow(nearest)
>
> Is there not a more automatic way to do this, where it sizes them based on
> their size, perhaps(haha)?
Set the Units property of spax1 and spax2 to pixels, then get their Position
properties and update the last two components of the Position based on the
sizes of the images.
Original = imread('eight.tif');
nearest = imresize(Original, 2, 'nearest');
figure
spax1 = subplot(1,2,1); imshow(Original)
spax2 = subplot(1,2,2); imshow(nearest)
set([spax1, spax2], 'Units', 'pixels')
P1 = get(spax1, 'Position');
P2 = get(spax2, 'Position');
% Assuming Original is a 2-D matrix, not a 3-D array
set(spax1, 'Position', [P1(1:2) size(Original)./2]);
set(spax2, 'Position', [P2(1:2) size(nearest)./2]);
You may also want to adjust the first two components, to "recenter" the axes
in their subplot area. Note, however, that this won't update the size of
the axes if you resize the figure. You might want to reset the Units
property to 'normalized' after the code above if that's necessary or useful
for your application.
--
Steve Lord
slord@mathworks.com
|