Re: 1D plots from 2D data [message #13920] |
Wed, 30 December 1998 00:00 |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
raph@phy.ornl.gov wrote:
>
> Hi All-
>
> I have YANQ (Yet Another Newbie Question), on which I'm hoping some
> kind soul will give me a head start. I have a 2D array f(i,j), which
> I'd like to plot versus i, bunching jmax points over each i. If I simply
> plot f(i,j) versus i, it treats f as a 1D array imax*jmax long, so I get
> a plot of f versus i+j*imax.
>
> Think of it as plotting a wave. By default, IDL plots multiple
> periods of the wave sequentially but I want to each period over the first.
> Is there an IDL routine which does this directly? Can I simply slice the
> data and overplot, which in pseudo-F90 would sorta look like
>
> Do j=1,jmax
> g=f(:,j)
> plot g
> Enddo
>
> Any pointers are appreciated,
> Raph
>
>
it's almost the same as in F90:
plot,f[*,j]
regards,
Martin
PS: and as a bonus point I allow myself to proliferate a tip from David
Fanning's excellent book on programming techniques in IDL:
If you want to index all elements from i0 to the last, simply write
f[i0:*,j]
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
|
|
|