MATLAB Examples

Revert to Default Marker Locations

Modify the marker locations, then revert back to the default locations.

Create a line plot and display large, square markers every five data points. Assign the chart line object to the variable p so that you can access its properties after it is created.

x = linspace(0,10,25);
y = x.^2;
p = plot(x,y,'-s');
p.MarkerSize = 10;
p.MarkerIndices = 1:5:length(y);

Reset the MarkerIndices property to the default value, which is a vector of all index values from 1 to the number of data points.

p.MarkerIndices = 1:length(y);