フィルターのクリア

Why is the colormap not working as expected?

2 ビュー (過去 30 日間)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017 年 1 月 20 日
コメント済み: Walter Roberson 2017 年 1 月 20 日
In the following program cellImage and spineImage, both are being displayed in jet.
One of them should be gray and another should be jet.
But, I see both of them as jet.
% read three 8-bit images
cellImage = imread('cell.tif'); %Read in 8 bit intensity image of cell
spineImage = imread('spine.tif'); %Read in 8 bit intensity image of spine
onionImage = imread('onion.png'); %Read in 8 bit colour image
subplot(3,1,1); imagesc(cellImage); axis image; %Creates a 3 X 1 mosaic of plots
axis off; colormap(gray); %display first image
subplot(3,1,2); imagesc(spineImage); axis image; %Display second image
axis off; colormap(jet); %Set colourmap to jet (false colour)
subplot(3,1,3); imshow(onionImage); %Display third (colour) image
Output

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 20 日
Up to and including R2014a, colormap was a figure property. With R2014b it started becoming an axes property. You would get the output you observe on R2014a or earlier. (Your earlier questions have not happened to mention which MATLAB you are using)
  2 件のコメント
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017 年 1 月 20 日
編集済み: Ba Ba Black Sheep! 2017 年 1 月 20 日
R2015a.
How can I modify this program to work in 2015a?
Walter Roberson
Walter Roberson 2017 年 1 月 20 日
ax = subplot(3,1,1); imagesc(cellImage, 'Parent', ax); axis(ax, 'image', 'off'); colormap(ax,gray)
ax = subplot(3,1,2); imagesc(spineImage, 'Parent', ax); axis(ax, 'image', 'off'); colormap(ax,jet)
ax = subplot(3,1,3); imagesc(onionImage, 'Parent', ax); axis(ax, 'image', 'off');

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by