3.3.2.34 Legend (command)



Creates a legend for the active graph window or updates the current legend if one exists.

Please see the legendupdate X-Function.

Syntax:

legend [option]

Options:

no option, Creates if no legend or update the legend on the active graph window

Syntax: legend

Creates or update a legend on the active graph window. If the original legend contains unnecessary lines not associated with any data plot (indicated as "####"), these lines will be eliminated by this command. This is useful, for example, when the graph is created from a template which contains many legend items.

-ah, rearrange legend entries horizontally into one row

Syntax: legend -ah

Rearrange legend entries horizontally into one row.

Also, see the label command flag -al.

-av, rearrange legend entries vertically into one column

Syntax: legend -av

Rearrange legend entries vertically into one column.


-d, Reset legend position

Syntax: legend -d

Reset legend position

-r, reconstruct a best fit legend

Syntax: legend -r

Reconstruct a best fit legend on the active graph window. This is equivalent to the menu Graph:Legend:Reconstruct Legend. When this is executed, Origin will create a most suitable legend based on the graph type and graph customization. Possible legend types to be reconstructed are legend for data plots, legend for box chart components, point by point legend and legend for categorical values. For details on each type of legend, you can refer to the Graph Legends, Color Scale and Bubble Scale chapter in the Origin Help book.

-s, create a legend in the parent layer

Syntax: legend -s

If...

  • no legend exists

and...

  • Include Data Plots from All Layers is selected on the Legends tab of the graph template's Plot Details dialog box...

then, it creates a legend in the parent layer -- or if no parent layer exists, in the active layer -- that includes data sets from all layers.This is equivalent to menu command Graph:New Legend (CTRL + L), when Include Data Plots from All Layers is selected on the Legends tab of the Plot Details dialog box.

Syntax: legend -sa

auto update legend

-p, Add the label to the individual plot using the information in the Parameters row

Syntax: legend -p

Used to label the individual line plots of active graph window, using the information stored in the Parameters row.


-tt, Legend text color follows plot

Syntax: legend -tt

Toggle legend text color follows plot

-v, Reverse the order in legend for data plots

Minimum Origin Version Required: 2015 SR0

Syntax: legend -v

If the current legend is for data plots and it has never been manually updated, use this command to reverse the order of data plot entries in the legend. It is equivalent to menu Graph:Legend:Reverse Order.

See Also:

Label (command)