IDL Programming > Objects > Graphics Object Classes > IDLgrLegend::Remove

IDLgrLegend::Remove

The IDLgrLegend::Remove procedure method removes a legend item from the legend.

Syntax

Obj->[IDLgrLegend::]Remove [, Items] [, /ALL]

Arguments

Items

A single item, an array of items, or a list of items to be removed from the legend. An item can be a graphic reference or a graphic name.

Keywords

ALL

Set this keyword to remove all legend items from the legend.

Example

; Draw four plots in the same window

sinewave = SIN( 2.0 * FINDGEN(200) * !PI / 25.0) * EXP(-0.2 * FINDGEN(200))

 

p1 = PLOT(sinewave, NAME='Plot 1')

p2 = PLOT(sinewave/2, NAME='Plot 2', COLOR='red', /OVERPLOT)

p3 = PLOT(sinewave/4, NAME='Plot 3', COLOR='green', /OVERPLOT)

p4 = PLOT(sinewave/6, NAME='Plot 4', COLOR='blue', /OVERPLOT)

l = LEGEND()

 

; Remove the second plot from the legend with its object reference

l.Remove, p2

 

; Remove the first and fourth plot from the legend with their name references

l.Remove, ['Plot 1', 'Plot 4']

Version History

8.2

Introduced