paxandroid.blogg.se

7 sins game plot
7 sins game plot









7 sins game plot 7 sins game plot

plot( x, sin( x ), 'rx', 'linewidth', 2, 'DisplayName', 'Line1' ) The syntax for the plot() should look like this. In both cases, after you have set the properties, you need to all legend() without any arguments to toggle the legend on. This can be done during the plot() call or using set() on the handle. Image by author Using the “DisplayName” PropertyĪnother convenient way to add the legend labels is to set the “DisplayName property on the lines as they are plotted. legStr = įor convenience, this method will be used for the rest of the examples. This is most useful when you are programmatically creating the legend string. In addition to specifying the labels as individual character strings, it is often convenient to collect the strings in a cell array. Plot( x, cos( 4x )/3, '^g', 'linewidth', 2 ) Ī legend can be added with the following command. Plot( x, sin( x ), 'rx', 'linewidth', 2 ) The basic syntax is: legend( ‘Description 1’, ‘Description 2’, … ).įor the examples in this section, we will generate a sample figure using the following code. The simplest way to use the function is to pass in a character string for each line on the plot. The legend() function in MATLAB/Octave allows you to add descriptive labels to your plots.

7 sins game plot

The source code for the included examples can be found in the GitHub repository. In this article, I cover the basic use of the legend() function, as well as some special cases that I tend to use regularly. Luckily, MATLAB/Octave include the legend() function which provide some flexible and easy-to-use options for generating legends. Plot legends are essential for properly annotating your figures.











7 sins game plot