Question about multiple imagesc on one axes, colorbar handling
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Walter Roberson
2015-5-6
That is, there are methods to transform relative-scaled data such as input to imagesc() into absolute data.
更多回答(1 个)
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().
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!