2. After the Advance

Plot Marker

Plots are used to have the knowledge in a particular topic without having any background knowledge about the performance of variables. They are very helpful to the uninformed audience to take decisions. There are many types of plots that are used depending on business requirements. They can be a bar plot, line plot, scatter plot, etc. Markers are used in the plot to identify the differences between the lines or highlight some of the relevant points in the line that are required during the analysis in the respective area.

Working of Matlab Marker in Plots

Markers in the plot can be used for many reasons like highlighting some of the important points which are required for the analysis or to distinguish between different points so that they can plot them with different prints and patterns. We can use this property while mentioning it in the input argument using different marker properties.


plot (a, b,’ name of the property’, ‘value’)

Here a and b are the inputs that we specify while plotting any graph. Generally, we use Marker to plot the line graphs using a name-value pair where we can draw the graph using plot () function in Matlab.

Examples of Matlab Plot Marker

Given below are the examples of matlab plot marker:

Example 1:

a = linspace (0,5,10);
b= a*2+sin(2*a);
plot (a, b,’-o’)


matlab plot maker 1

This will plot a line graph with all the points marked in a circle format, which is usually known as circle markers. If we specify no line in the command, then the output will be in the form of markers only, without displaying any line which is required to connect the points.

Example 2

a = linspace (0,5,10);
b= a*2+sin(2*a);
plot (a, b,’o’);


matlab plot marker 2

We can specify the marker size and color to show the placement of markers. We can change these properties using the name-value pairs depicting the property of the marker and the required value of the respective property. Marker Size is the property that is used to specify the size of points and it is always a positive value. Marker edge color is the property that is used to specify the color that we want to mark the outline of the graph. Each color has its own unique RGB triplet value which can be mentioned in the argument also.

We can also mention the color name in the input argument for the changes in the plot. Marker Face Color is used for the inside color that we want to give in the plot. This property can also be specified in the input argument using the color name or RGB triplet value. Marker colors can be red, blue, green, cyan, Magenta, Yellow, Black, and White. We can also see the property of the line by specifying the necessary symbol along with the marker sign or shape like ‘- ‘is the solid line which is the default line, ‘— ‘is the dashed line,’:’ is the dotted line and ‘-.’ Is the dashed-dotted line.

Example 3:

a = linspace (0,5,10);
b= a*2+sin(2*x);
plot (a, b,'-s','MarkerSize',5, ...
'MarkerEdgeColor','blue’, ...
'MarkerFaceColor',[1 .4 .4])


Example 3

In the above example, we have used all the three properties which we have discussed in the above paragraph. Marker size we have given as 5, Marker edge color as blue and the last property Marker Face color we have specified using the RGB triplet value. Based on the intensities we want, we can decide the RGB triplet value and mention it in the command for the desired results.

We can also control the placement of the markers depending on the requirements so that we can display the markers only in certain data points as mentioned in the input argument. This can be achieved by using Marker Indices property in Matlab which helps in the distribution of markers in the relevant data points. For example: If we want to display the marker in every 5th data point which starts from the first data point then we can give it as input to the command which will show the marker only in the respective position. We can also display the maximum and minimum points in the line graph by specifying it in the Marker Indices property. Please find the below example explaining the above property.

In the above example, we have applied to find function to find the minimum and maximum value in the input which has a function and then applied those variables in the Marker Indices property to denote only the maximum and minimum points. We can also change the location of the marker to its default position if we want to revert any changes. This can also be achieved by using the Marker Indices property in Matlab by describing the length of the variable used from the starting point of the plot.

There are different Marker Symbols which are used while plotting the line graphs and are supported in Matlab like ‘o’ is used to denote the circle markers,’*’ is known as asterisk marker,’.’ Is known as point marker,’+’ is known as plus marker,’x’ is known as cross marker,’s’ is known as square marker, ’d’ is known as diamond marker,’^’ is known as upward triangle marker,’v’ is the downward triangle,’>’ is known as triangle pointing right,’<’ is known as triangle pointing left, ’p’ is the pentagram market which has five-pointed star, ’h’ is the hexagram market which has six-pointed star and none is for no marker point.

Leave a Reply

Your email address will not be published. Required fields are marked *