How to plot contour on imagesc for three variables?

3 views (last 30 days)
I want to obtain the folllowing figure using the program mentioned below. The three variable red encircled can be placed as x,y,z-axis. How can I modify my program to get such like figure?
close all;
clear all;
clc;
%% ------------------------------Program-------------------------------------
EC = [0.0052 0.0078 0.0104 0.0130 0.0156 0.0182 0.0208 0.0234 0.0260 0.0286];
Reff =[4:1:20];
FOV=[1,2];
for i=1:length(FOV)
for j = 1:length(EC)
for k = 1:length(Reff)
I0= getsignal([num2str(j),'FOV_',num2str(FOV(i)),'mrad\out_resultsG_I0.dat']);
Q0= getsignal([num2str(j),'FOV_',num2str(FOV(i)),'mrad\out_resultsG_Q0.dat']);
I(:,j)= smooth(sum(I0,2));
Q(:,j)= smooth(sum(Q0,2));
if(i==1)
dep1(:,j)= (I(:,j)-Q(:,j))./(I(:,j)+Q(:,j));
plot(dep1(:,j),z,'LineWidth',1.5,'color',col(:,j));
end
if(i==2)
dep2(:,j)= (I(:,j)-Q(:,j))./(I(:,j)+Q(:,j));
plot(dep2(:,j),z,'LineWidth',1.5,'color',col(:,j));
end
imagesc(num2str(Reff(k)),num2str(EC(j)),depi(j,k).')
colorbar
end
end
end
figure('name','depolarization ratio')
hold on
contour(Reff,EC,depi')
hold on
imagesc(Reff,EC,depi')
colorbar

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 11 Apr 2022
Maybe it is enough for you to make this minor modification:
figure('name','depolarization ratio')
imagesc(Reff,EC,depi')
hold on
c_levels = (15:5:65)/1000; % Your contour-levels might be completely different
[c,h] = contour(Reff,EC,depi',c_levels,'k'); % make contours black - to not get the same colours as the imagesc-map
clabel(c,h)
colorbar
HTH

More Answers (0)

Community Treasure Hunt

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

Start Hunting!