Issue with colormap using Matlab 2016b

4 ビュー (過去 30 日間)
Roberto Emanuele Rizzo
Roberto Emanuele Rizzo 2016 年 10 月 17 日
When I try to run a process with Matlab-2016b specifying a desired color palette (in the specific case jet) the output always returns a grayscale map instead. Does anybody experienced a similar issue? Can somebody please give me some advices on how to fix this? Following the code I use to generate the maps:
imshow(WCnorm_theta) ;
set(gca,'YDir','reverse') ;
axis on square tight ;
box on ;
caxis([ 0 1 ]) ;
colormap jet;
colorbar('eastoutside') ;
xlabel('X, pixels') ;
ylabel('Y, pixels') ;

回答 (2 件)

Adam
Adam 2016 年 10 月 17 日
Use the specific object handle - e.g.
colormap( hAxes, 'jet' )
where hAxes is your axes handle.
  1 件のコメント
Roberto Emanuele Rizzo
Roberto Emanuele Rizzo 2016 年 10 月 17 日
Thank you very much. I have use a combination of the two suggested answer and it worked!! :-)
bAxes = subplot(2,2,1) ;
imshow(dataImageBW) ;
set(gca,'YDir','reverse') ;
axis on equal tight ;
box on ;
caxis([ 0 1 ]) ;
colormap(bAxes,jet(256));
colorbar('eastoutside') ;
title('Binary image') ;
xlabel('X, pixels') ;
ylabel('Y, pixels') ;

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


Image Analyst
Image Analyst 2016 年 10 月 17 日
Yes, I've seen this too (it broke my existing code). I called the Mathworks and the answer was that colormap() now requires you to pass in the handle of the axes that you want to apply it to. It no longer just works on the current axes.
colormap(gca, jet(256));
  1 件のコメント
Roberto Emanuele Rizzo
Roberto Emanuele Rizzo 2016 年 10 月 17 日
Thank you very much. I have use a combination of the two suggested answer and it worked!! :-)
bAxes = subplot(2,2,1) ;
imshow(dataImageBW) ;
set(gca,'YDir','reverse') ;
axis on equal tight ;
box on ;
caxis([ 0 1 ]) ;
colormap(bAxes,jet(256));
colorbar('eastoutside') ;
title('Binary image') ;
xlabel('X, pixels') ;
ylabel('Y, pixels') ;

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by