How to close open contours
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ForHim
el 19 de Oct. de 2021
Comentada: ForHim
el 21 de Oct. de 2021
I would like to close the open contours in the attached image. The contour lines just stop at both the top and bottom of the image. I am trying to find a non-image analysis solution, as this plot was created with the contour function using the following syntax:
[C, h] = contour(X, Y, Z, [level_1 level_2 level_3 level_4 level_5]);
I would like it to close with just a horizontal line connecting to the corresponding isoline/color at both the top and bottom. Either a programatic or brute force solution would be ok with me. I would like to have the connected contour plot available as a Contour matrix, which is what the contour function outputs (https://www.mathworks.com/help/matlab/ref/contour.html).
Thanks!

0 comentarios
Respuesta aceptada
DGM
el 19 de Oct. de 2021
The contours are open because that's what describes the data. To close the contours misrepresents the behavior of the data at the edges. If this were elevation data, you would be explicitly fabricating an artifact that describes a vertical surface at the edge of the plot. You can do it if you want.
z = peaks(100);
z = z(:,1:50);
contour(z);
xlim([-10 60])
ylim([-10 110])
clf
z = padarray(z,[1 1],0,'both');
contour(z);
xlim([-10 60])
ylim([-10 110])
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Contour 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!