comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: adding legend with cgzplot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: adding legend with cgzplot [message #83172] Fri, 08 February 2013 04:57
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
idlhelp writes:

> I want to add the legend in the plot. And for making plots I am using cgZplot. But I don't know how to add legend with that. This is how I am doing but it doesn't work.
>
> oplotObj = Obj_New('CGOVERPLOT',a,b,color='red')
> cgZplot,c,d,color='black',OPLOTS=oplotObj
> legend,['Temp','Days'],linestyle=[0,0],color=['black','red']
>
>
> Does anyone know how to do that

As explained in the on-line documentation for the LEGEND keyword:

oplotObj = Obj_New('CGOVERPLOT',findgen(101), $
cgDemodata(17),color='red')
legendItem1 = Obj_New('cgLegendItem', Color='black', $
Location=[0.775, 0.875], Title='Temp', Length=0.05)
legendItem2 = Obj_New('cgLegendItem', Color='red', $
Location=[0.775, 0.835], Title='Days', Length=0.05)
cgZplot,findgen(101), cgDemodata(17),color='black',$
OPLOTS=oplotObj, LEGEND=[legendItem1, legendItem2], $
YRange=[0,125]

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: adding legend with cgzplot
Next Topic: WShow Sorta Works in IDL 8.2.2

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:31:17 PDT 2025

Total time taken to generate the page: 0.00607 seconds