Marker on contourf plot
Mostrar comentarios más antiguos
Dear all,
I have plotted a contour plot using contourf using Z2. I would like to add markers at certain values in Z2, these values are in LS1 and LS2. But instead of plotting the marker directly on top of the contour plot, I get something like the image:
load('Test.mat');
contourf(Z2,20,'edgecolor','none');
hold on;
plot(LS1,'b+','MarkerSize',5);
hold on;
plot(LS2,'rx','MarkerSize',5);
colorbar;
Does anyone have any idea on the issue? Thank you very much!
Respuesta aceptada
Más respuestas (1)
Akira Agata
el 28 de Dic. de 2022
Editada: Akira Agata
el 28 de Dic. de 2022
Please use (x,y) coordinate for plotting markers.
The following is an example:
load('Test.mat');
% Find (x,y) coordinate of values
[row1, col1] = find(~isnan(LS1));
[row2, col2] = find(~isnan(LS2));
% Visualize the result
figure
contourf(Z2, 20, "EdgeColor", "none");
hold on
scatter(col1, row1, "b+")
scatter(col2, row2, "rx")
colorbar;
1 comentario
Eli
el 28 de Dic. de 2022
Categorías
Más información sobre Contour Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
