Imagesc and superimpose 2 .mat files (of unequal sizes) with different colormaps

1 回表示 (過去 30 日間)
Ankit Sahay
Ankit Sahay 2021 年 3 月 2 日
コメント済み: KALYAN ACHARJYA 2021 年 3 月 2 日
Hi everybody,
I have two mat files (vort & flame_deg) and their corresponding coordinate data. vort -> xv, yv & flame_deg -> xf,yf. All the mat files have been attached.
Both the mat files are of different dimensions, but they overlap in a certain range, as is evident from the xv, yv, xf & yf files. I want to plot vort in the background with some colormap (eg. parula), and plot flame_deg in the foreground with a different colormap (eg. hot). A large portion of values in flame_deg (foreground data) has NaN elements. which I would like to keep as 100% transparent.
If I plot the .mat files using the following commands:
figure;
ax1 = axes;
imagesc(xv,yv,vort);
colormap(ax1,'parula');
hold on;
ax2 = axes;
imagesc(xf,yf,flame_deg);
colormap(ax2,'hot');
ax2.Visible = 'off';
linkprop([ax1 ax2],'Position');
colorbar;
linkaxes([ax1 ax2])
I get something like this:
As it can be seen, a large portion of the foreground image has NaN values, which I would like to be completely transparent so that I can see the background vort image. The choice of colormaps is an entirely different topic, I will resolve it later. I do not want to keep either of the colormaps as grayscale.
I have gone though tons of examples present on the different forums (MATLAB answers, StackExchange) like this, this, this, this etc. Unfortunately, none of them worked. It may be that one of them might have the answer that I am looking for and I am too dumb to find it, or that none of them have addressed this issue so far.
I request someone to help me solve this issue. Thank you.
  2 件のコメント
Ankit Sahay
Ankit Sahay 2021 年 3 月 2 日
The following change solved my problem:
imagesc(xf,yf,flame_deg,'AlphaData',~isnan(flame_deg));
This gives me something like this:
I am going to let this question remain on the forum in case somebody else needs it.
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 3 月 2 日
Problem Solved!

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by