Member of the plots class.
legend off
legend(text1, text2, ...)
legend(text1, text2, ..., location)
Adds a legend to the current plot. legend off hides the legend in the current plot. You can specify as many labels in the legend as there are variables. The legend function works exclusively with the plot function.
| Name | Description | ||||||||
| text1 | Specifies the label in the legend for the first variable. | ||||||||
| text2 | Specifies the label in the legend for the second variable. | ||||||||
| location | Specifies where to add the legend to the plot. location is a scalar that accepts the following values.
|
This function is not supported in the LabVIEW Run-Time Engine. This function can remain in your scripts when you build a stand-alone application or shared library, but the LabVIEW Run-Time Engine does not execute this function.
X = 0:0.1:1;
Y = X.*X;
Z = sin(X);
plot(X, Y, 'r', X, Z, 'b')
legend('quadratic', 'sin')
X = 0:0.3:6;
Y = cos(X);
Z = sin(X);
plot(X, Y, 'bo-', X, Z, 'mo-')
legend('cos', 'sin', 3)