No degradation color on the 3D plot

4 views (last 30 days)
Lasfitri Rosanty Sinaga
Lasfitri Rosanty Sinaga on 5 Dec 2022
Edited: Rajeev on 24 Feb 2023
I need more help please. I want to plot 3D function (x,y,z), the result is actually right (around xe-4 until xe-2) but there is no degradation color on my plot that showing the limit line for z-variable. Is the mistake on the Lmin Lmax Input?
So much thanks in advance!
%sensitivity analysis
%lifetime and efficiency
lifetime=linspace(30,5,20);
efficiency=linspace(0.3,0.05,20);
l=length(lifetime);
e=length(efficiency);
H2MSAeff=zeros(l,e);
for i=1:e
for j=1:l
[aa]=H2MSA_conversion(lifetime(j),efficiency(i), msaprice);
plot_H2MSA_conversion=[aa];
H2MSAeff(i,j)=plot_H2MSA_conversion(key);
end
end
efficiency=efficiency*100;
[Lifetime,Efficiency,H2MSAeff]=griddata(lifetime,efficiency,H2MSAeff,linspace(min(lifetime),...
max(lifetime),100)',linspace(min(efficiency),max(efficiency),100),'linear');
if figurekey==1
Lmin=min(min(H2MSAeff));Lmax=max(max(H2MSAeff));
L=[Lmin,0.00001,0.0001,0.0002,0.0004,0.001,Lmax];
L=roundn(L,-1);
[C,h]=contourf(Lifetime,Efficiency,H2MSAeff,L,'ShowText','on','color','white');
clabel(C,h,'FontSize',13,'Color','w'); %Set curve label font size
colorbar;
colormap(parula);
xlabel('Lifetime(year)');
ylabel('STH Efficiency(%)');
m = get(gca,'XTickLabel'); % Set font size of axis
set(gca,'XTickLabel',m,'fontsize',13);
end
if figurekey~=1
end
  1 Comment
Divyanshu
Divyanshu on 23 Feb 2023
Can you provide more information regarding the values of the variables and functions called, so that it would be easier to reproduce the issue?

Sign in to comment.

Answers (1)

Rajeev
Rajeev on 24 Feb 2023
Edited: Rajeev on 24 Feb 2023
It seems like the issue might be with the way the contour levels are set using:
% Original contour levels
L=[Lmin,0.00001,0.0001,0.0002,0.0004,0.001,Lmax];
The values in L are all very close to each other and may not give you the desired colour degradation. You can try changing the values in L to have a larger range, for example,
% Contour levels with larger spacing in between
L=[Lmin,0.0001,0.001,0.01,0.1,1,Lmax];.
Also, the colormap can be adjusted to better represent the range of values in your data. For example, you can try using the ‘jet’ colormap instead of ‘parula’ by changing colormap(parula) to colormap(jet).

Categories

Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!