how to add markers on specific points ??
조회 수: 3 (최근 30일)
이전 댓글 표시
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;
댓글 수: 0
답변 (1개)
Cris LaPierre
2024년 2월 6일
편집: Cris LaPierre
2024년 2월 6일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!