Effacer les filtres
Effacer les filtres

how to add markers on specific points ??

12 vues (au cours des 30 derniers jours)
Shahriar Shafin
Shahriar Shafin le 6 Fév 2024
Modifié(e) : Cris LaPierre le 6 Fév 2024
In my code,my markers position in a separate legend.I want to put the marker legend on the same line plot legend(MSD50) .
F = openfig("MSD2.fig");
MarkerIndices = 1:50:length(timeps);
hold on;
plot(timeps(markerIndices), MSD50(markerIndices), 'Marker', 'o', 'LineStyle', 'none', 'Color', 'r');
hold off;

Réponses (1)

Cris LaPierre
Cris LaPierre le 6 Fév 2024
Modifié(e) : Cris LaPierre le 6 Fév 2024
The MarkerIndices property was introduced around R2016b. This allows you to specify which points have a marker. See this example
Here's what it might look like to add a red dot every 25 points.
x=0:100;
y = 2.5*x;
plot(x,y,'g.--','MarkerFaceColor','red','MarkerEdgeColor','red','MarkerIndices',1:25:length(y))
legend

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by