Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

legend (MathScript Function) (Windows, Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Member of the plots class.

Syntax

legend off

legend(text1, text2, ...)

legend(text1, text2, ..., location)

Description

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.

Details

Examples

Inputs

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.

1 (default) Adds a legend to the upper-right corner of the plot.
2 Adds a legend to the upper-left corner of the plot.
3 Adds a legend to the bottom-left corner of the plot.
4 Adds a legend to the bottom-right corner of the plot.

Details

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.

Examples

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)

Related Topics

plot


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit