www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/DisplayOnlySomeMarkersOnLinePlotExample.m
%% Add Markers By Superimposing Markers over Line Plot % If you are using R2016a or earlier, then the |MarkerIndices| property is % not available. To add markers to specific data points along a line, % plot the line and then superimpose a second plot of markers over the % line. % % For example, plot a line and display markers at intervals of $\pi/2$ % along the _x_ direction. Set the color of both plots to blue so that they % match. x = linspace(0,2*pi,100); y = sin(x); plot(x,y,'b') hold on xmarkers = 0:pi/2:2*pi; ymarkers = sin(xmarkers); plot(xmarkers,ymarkers,'b*') hold off