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

Home » Public Forums » archive » Re: plots?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: plots? [message #31778] Tue, 20 August 2002 11:30 Go to previous message
MKatz843 is currently offline  MKatz843
Messages: 98
Registered: March 2002
Member
Helen, IDL is more elegant than you suppose.

I would suggest using arrays rather than FOR loops.
(David meant findgen() rather then fltarr(), I assume.)
With the plots outside of a loop, you won't need to use the /continue
keyword.

Whenever I need to set up a plot and then draw the plot in two steps,
I use the /data keyword. Then you don't need to hassle with !X, !Y,
and the like. This is done in testPlots2 below.

An even more compact version is in testPlots3 below. This may or may
not work for you, but I combine the creation of the plot and the
actual plotting into one step using plot rather than plot & plots.
They keywords to plot let you choose the domain and range (x and y)
yourself, and the ystyle=1 setting allows you to force the use of
[-5,5] rather than the automatically-selected [-6,6].

pro testPlots2
window, 1
plot,[0,10],[-10,10], /NoData
window,2
plot,[0,10],[-5,5], /NoData

I = findgen(11)
arrayY = cos(I+1)
arrayX = sin(I+1)
arrayT = I

wset, 1
plots, arrayT, arrayX, /data
wset, 2
plots, arrayT, arrayY, /data
end



pro testPlots3
I = findgen(11)
arrayY = cos(I+1)
arrayX = sin(I+1)
arrayT = I

window, 1
plot, arrayT, arrayX, /data, xrange=[0,10], yrange=[-10,10]
window, 2
plot, arrayT, arrayY, /data, xrange=[0,10], yrange=[-5,5], ystyle=1
end

I hope this points you in the right direction,

M. Katz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Weighting Function
Next Topic: Re: Frame-rate of IDL's MPEG movies ?

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

Current Time: Wed Oct 08 19:59:56 PDT 2025

Total time taken to generate the page: 0.00395 seconds