Display NaNs values and apply alphadata for values different to NaNs

7 次查看(过去 30 天)
Hello,
I want to display the NaN values by setting an alphadata equal to 0 and at the same time apply an alphadata equal to 0.3 for values different to NaNs?
This is the code i use but it doesn't work:
im=imagesc(I)
set(im,'AlphaData',0.3);
set(im,'AlphaData',~isnan(I))
Thanks,

采纳的回答

Ameer Hamza
Ameer Hamza 2020-11-11
Try this
im = imagesc(I);
im.AlphaData = 0.3*ones(size(I));
im.AlphaData(isnan(I)) = 0;
  1 个评论
Haythem Zouabi
Haythem Zouabi 2020-11-12
Hello,
I need to resize and define the position of the colorbar.
This is my code:
ax3 = subplot(2,3,2);
ibg2 = imagesc(scene);
axis off
hold on
iim2 = imagesc(im,'XData',[16 466],'YData',[104 484]);
caxis([0 3])
iim2.AlphaData = 0.75*ones(size(im));
iim2.AlphaData(isnan(im)) = 0;
colorbar
colormap parula
caxis([0 3])
cb = colorbar;
set(cb,'position',[.10 .1 .1 .1])
This is the graph i get :
I need to place the color bar in the blue box (see figure)?
Thanks,

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by