필터 지우기
필터 지우기

Question about multiple imagesc on one axes, colorbar handling

조회 수: 6 (최근 30일)
Brian
Brian 2015년 5월 6일
답변: Image Analyst 2015년 5월 6일
Hello, thanks for reading this.
I've been stewing over this for a while, and I've been partially successful with this. What I want to do is create a single axes plot with two imagesc plots, with colorbars for each imagesc. What I can do at the moment is plot two fused imagesc datasets as one dataset, I can plot two imagesc and hold on, and I can use indexing on the NaN values to fill in one image into another (my datasets consist of a torso with a NaN cavity for lungs, and another for the lungs). I plot them both on one axes.
Note I want to plot these separately because the torso and lungs have apple and orange datasets. The only consistent information is the x,y,z spatial location of the pixels.
So like I said earlier, I can overlay the two images pretty well on one axes. My problem comes from being unable to make two colorbars for the two fused imagesc.
Is it possible to make colorbar data for the imagesc using the spatial orientation of the pixels, plus the cdata? I've tried looking at some of the demos out there, but the way I create my fused image makes multiple colorbars difficult.
Thanks for any advice you can give.

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 6일
Have you considered using the file contribution freezeColors ?
That is, there are methods to transform relative-scaled data such as input to imagesc() into absolute data.
See also the Colormap / Colorbar Utilities file contribution
  댓글 수: 1
Brian
Brian 2015년 5월 6일
Thanks, will take a look. This seems the close, probably the closest I'll get, I'll have to be creative with it though.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 5월 6일
What I would do is to stitch each indexed/grayscale image with a gray ramp on the right. (I assume you know how to make a ramp with linspace() and repmat() - let me know if you don't). Then do it for the second image. Then convert those two images to an rgb image with ind2rgb().
image1 = [image1, verticalRamp];
colormap1 = jet(256); % Whatever colormap you want.
rgb1 = ind2rgb(image1, colormap1);
image2 = [image2, verticalRamp];
colormap2 = hsv(256); % Whatever colormap you want.
rgb2 = ind2rgb(image2, colormap2);
Then stitch them together
rgbPair = [rgb1, rgb2];
imshow(rgbPair);
If you want intensity labels along the ramp, then use text().

카테고리

Help CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by