Trying to only fill certain contours in a contour3 plot
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a contour3 plot overlying a surf plot and I am trying to find a way to only fill between two of the contours and not the others
%surf plot
figure
surf(X,Y,Z)
colormap gray;
camlight headlight;
lighting flat
grid on
shading interp
view(0,90)
title('Map of the Island')
xlabel('Longditude')
ylabel('Latitude')
zlabel('Elevation')
c = colorbar;
hold on
%3d contour plot
contour3(X,Y,Z,[0.1 200,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000,3250,3500,3750,4000])
I'm trying to change just the colour between 200 and 500 red and leave the rest unfilled. Is there a way to do this? Or would it be better to set up some kind of subplot of the surf plot and change that red, if so, how would I do that?
0 comentarios
Respuestas (1)
Vedant Shah
el 12 de Mzo. de 2025
To fill a specific colour between only two contours while leaving the others unfilled, specific contour levels can be defined, and properties such as color can be explicitly set using “contour3” function. The official MATLAB documentation provides further details and can be accessed using the following command:
web(fullfile(docroot, "/matlab/ref/contour3.html"))
To achieve the desired result, the following line can be incorporated into the code:
contour3(X,Y,Z,[200, 500], 'r', 'LineWidth', 2);
This method effectively highlights the area between the chosen contour levels using sample data, while keeping the other contours visible.
0 comentarios
Ver también
Categorías
Más información sobre Surface and Mesh Plots 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!