There are several parts of a plot within a figure window which can be labeled by the programmer. These parts are locations relative to the two-dimensional axes.

 

 

The horizontal and vertical axes can be labeled by using the commands: xlabel(‘string’) and ylabel(‘string’), respectively.

 

The title of the axes can be labeled using the command: title(‘string’).

 

Within the axes, a legend can be included to label each line using the command: legend(‘string1’, ‘string2’, … ,‘stringN’). In this case, the order of the strings within the command should follow the order in which the lines were plotted in the figure window.

 

Using a figure legend is very useful whenever displaying multiple plots. Let’s look at that next.

Receive Updates

No spam guarantee.