MATLAB Answers

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

12 views (last 30 days)
Ankit Sahay
Ankit Sahay on 2 Mar 2021
Commented: KALYAN ACHARJYA on 2 Mar 2021
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:
ax1 = axes;
hold on;
ax2 = axes;
ax2.Visible = 'off';
linkprop([ax1 ax2],'Position');
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.

Sign in to comment.

Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by