I need a little help with this 3d plot contour.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Tamás Zsombor Tolvaj
el 15 de Abr. de 2022
Comentada: Tamás Zsombor Tolvaj
el 15 de Abr. de 2022
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/965250/image.jpeg)
The task is about islands, which I managed to plot in 3d, but I have a small issue with the contour part.
This is the contoured map of our task, and I dont know how I can color the areas between -2 and 0 with green. Areas below -5 need to be blue, which I could solve, but I dont know how I can do it with green parts. The code looks like this, and the only problem I have is the coloring:
x=-4:0.1:4;
y=-4:0.1:4;
[X, Y] = meshgrid(x,y);
Z = 2*(peaks(X, Y)-3);
[C,U,V,W,fig1,plt1,plt2,fig2,plt3,cl] = tengerpart(X,Y,Z); %this is the call function
function [C,U,V,W,fig1,plt1,plt2,fig2,plt3,cl] = tengerpart(X,Y,Z)
fig2=figure(2); %and this is my try for it
map=[0 0 1; 0 1 0; 1 1 1; 0 1 0];
colormap(map);
v=[-25, -5, -2, 0];
plt3=contourf(X, Y, Z, v);
xlim([-4 4]);
ylim([-4 4]);
cl=clabel(plt3, v);
end
0 comentarios
Respuesta aceptada
Dyuman Joshi
el 15 de Abr. de 2022
x=-4:0.1:4;
y=-4:0.1:4;
[X, Y] = meshgrid(x,y);
Z = 2*(peaks(X, Y)-3);
fig2=figure(2);
map=[0 0 1; 1 1 1; 1 1 1; 1 1 1; 1 1 1; 1 1 1; 1 1 1; 1 1 1; 0 1 0; 1 1 1];
colormap(map);
v=[-25, -5, -2, 0];
plt3=contourf(X, Y, Z, v);
xlim([-4 4]);
ylim([-4 4]);
cl=clabel(plt3, v);
colorbar
Más respuestas (0)
Ver también
Categorías
Más información sobre Polygons en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!