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!