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

Home » Public Forums » archive » legend() with a mix of plot() and contour()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
legend() with a mix of plot() and contour() [message #77984] Wed, 12 October 2011 12:27
Brian Daniel is currently offline  Brian Daniel
Messages: 80
Registered: July 2009
Member
Dear IDL-er's,

I've recently started playing with the NG system. Oddly enough, its
been working well for me, but I've run into an odd behavior of
legend(). I use plot() for some data, then to draw a geometrical
function on top of it, I create coordinate arrays and use contour()
with the c_value keyword set.

The problem is when I attempt to show a legend only the calls to
plot() are listed. Nowhere in the documentation does ITT discuss this
limitation. Has anyone used legend for other graphing routines?
Here's a simple example:

dataX = randomn(1,300)
dataY = randomn(2,300)
p = plot(dataX,dataY, linestyle=6, symbol='.', Name='Data')
xrange = p.xrange
yrange = p.yrange

; create coordinates
N_samp = 200 ; number of samples in "cartoon" space
xx = findgen(N_samp)/(N_samp-1) * (xrange[1]-xrange[0]) + xrange[0]
yy = findgen(N_samp)/(N_samp-1) * (yrange[1]-yrange[0]) + yrange[0]
x = xx # replicate(1.0,N_samp)
y = replicate(1.0,N_samp) # yy

; function to draw
r = sqrt((x-0.5)^2.0 + (y-0.5)^2.0)

; draw the function
c = contour(r,xx,yy,c_linestyle='__',color='red', C_Value=1.0,
Name='Circle', /Overplot)

; add a legend
l = legend(target=[p,c],position=[0.15,0.85],/Norm)
[Message index]
 
Read Message
Previous Topic: ROI_pac
Next Topic: fitting many linear eqs simultaneously with outliers

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

Current Time: Fri Oct 10 10:30:34 PDT 2025

Total time taken to generate the page: 1.03962 seconds