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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Ankit Sahay
Ankit Sahay il 2 Mar 2021
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.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by