Make a contourf plot beautifuller
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Steffen B.
am 19 Jan. 2024
Kommentiert: Star Strider
am 22 Jan. 2024
Hello,
I have a question regarding the contourf plot in Matlab.
With my script:
f=figure(2);
fontSize=20;
f.Position(3:4)=[1280 1080];
%
contourf(x,y,T,15)
clabel(contourf(x,y,T,15,"-b"),'FontSize', fontSize)
cb= colorbar;
c=turbo(20);
colormap(c);
shading interp
set(gca,'ydir','reverse')
set(gca,'FontSize',fontSize)
set(cb,'FontSize',fontSize)
set(gca,'FontSize',fontSize)
xlabel('X/ m','FontSize', fontSize)
ylabel('Y/ m','FontSize', fontSize)
I get this plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1594846/image.png)
It's not beaufifull.
I would like create something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1594851/image.png)
Is it possible to smooth the contourf plot to create a better plot?
Would it be also possible to achive a plot without filled areas, only with colored isolines? Like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1594856/image.png)
With best regards
Steffen
0 Kommentare
Akzeptierte Antwort
Star Strider
am 19 Jan. 2024
Bearbeitet: Star Strider
am 19 Jan. 2024
The first one (with or without contour lines) is possible with a combination of the surf and view functions —
[X,Y,Z] = peaks(50);
figure
surf(X, Y, Z)
shading('interp')
view(0, 90)
figure
contour(X, Y, Z, 'LineWidth',1.5)
Ax = gca;
Ax.Color = [1 1 1]*0.7;
Combining them —
Zoffset = 2;
figure
surf(X, Y, Z)
shading('interp')
hold on
contour3(X, Y, Z+Zoffset, 'LineWidth',2)
hold off
view(0, 90)
EDIT — Corrected Errors.
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Contour Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!