Changing the size of a subimage plot in a subplot
1 回表示 (過去 30 日間)
古いコメントを表示
I need to display two images in one figure. They need to be in one figure, because I need to make a movie of a series of 1000s of these images.
The two images have different colormaps. Therefore, the only way (I could find) to display them is to use subimage() from the image processing toolbox.
Actually this worked OK, but now I cannot scale the image any more. Example Code is below: The same clown that is displayed with subimage does not come out scaled to the full width of the plot.
Can anybody tell me how to display two images with different colormaps and still be able to change their size?
Any help is appreciated.
Thanks
Philipp
if true
s = load('clown') ;
ah1 = subplot(2,1,1);
image(s.X);
cb = colorbar('location','NorthOutside');
ah2 = subplot(2,1,2);
subimage(s.X , gray);
pos1 = get(ah1,'Position');
pos2 = get(ah2,'Position');
pos1(3) = .9 ;
pos2(3) = .9 ;
set(ah1,'Position',pos1);
set(ah2,'Position',pos2);
end
0 件のコメント
回答 (2 件)
Bogdan Dzyubak
2015 年 7 月 2 日
編集済み: Bogdan Dzyubak
2015 年 7 月 2 日
One way to do this is by displaying an image with the colormap, capturing it with getframe, and then displaying the result in the subimage:
imshow(X); colormap('jet');
f = getframe(gca); % current axis
figure;
subplot(...); subimage(f.cdata) % jet colormap
subplot(...); subimage(Y); % grayscale
0 件のコメント
Walter Roberson
2015 年 7 月 2 日
Starting in R2014b, each axes can have a different colormap.
Before that, you can use the File Exchange contribution "freezeColors" to convert the images to truecolor.
You can put two images at different positions in the same axes by using image() or imagesc() with the XData and YData parameters.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!