CGLEGENDITEM__DEFINE
The purpose of this program is to create a simple legend object that can be drawn on
a data plot. The user can include any number of legend "items" in the final legend.
Categories
Graphics
Examples
A plot with a simple legend::
cgDisplay, 800, 450
cgPlot, cgDemoData(17), PSym=-6, SymColor='red7', Position=[0.15, 0.15, 0.7, 0.9]
cgOPlot, cgDemoData(17), PSym=-15, SymColor='blu7'
legendObj = Obj_New('cgLegendItem', SymColor=['red7', 'blu7'], $
PSym=[6,15], Symsize=1.5, Location=[0.725, 0.9], Titles=['May 27', 'June 27'], $
Length=0.075, /Box, VSpace=2.75, /Background, BG_Color='rose', /Draw)
Obj_Destroy, legendObj
Same as the previous example, but in a resizeable graphics window::
cgWindow, WXSize=800, WYSize=450
cgPlot, cgDemoData(17), PSym=-6, SymColor='red7', Position=[0.15, 0.15, 0.7, 0.9], /AddCmd
cgOPlot, cgDemoData(17), PSym=-15, SymColor='blu7', /AddCmd
legendObj = Obj_New('cgLegendItem', SymColor=['red7', 'blu7'], $
PSym=[6,15], Symsize=1.5, Location=[0.725, 0.9], Titles=['May 27', 'June 27'], $
Length=0.075, /Box, VSpace=2.75, /Background, BG_Color='rose', /AddCmd)
Author
FANNING SOFTWARE CONSULTING::
David W. Fanning
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: [email protected]
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
History
Change History::
Written 18 July 2012. DWF.
Adapted to accept multiple legend elements. Legend elements are stacked vertically.
Each legend element can be given its own title, color, symbol symbol color, and
linestyle. Legend elements are offset by 1.3*!D.Y_CH_Size/!D.YSize. A single
symbol can now be drawn in the center of the line instead of one at each end
point with the CENTER_SYM keyword. 04/25/2013, Matthew Argall.
Many changes to make this work like a simple, but useful, legend-drawing program. Now
called by the wrapper cgLegend. 5 Dec 2013. DWF.
Several small problems with pointers in the SetProperty method fixed. 10 June 2014. DWF.
Added CharThick keyword. 1 Sept 2014. DWF.
Copyright
Copyright (c) 2013, Fanning Software Consulting, Inc.