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

Home » Public Forums » archive » Re: plotting an array values keeping origin as a reference value
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: plotting an array values keeping origin as a reference value [message #80737] Mon, 02 July 2012 05:36
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
shambhu writes:

> I have an array a=[4,2,6,9,3,1]. I wan to plot these array values from
> origin, like (0,4),(0,2),(0,6) etc. How to plot this.

I would do it like this:

a=[4,2,6,9,3,1]
b = Indgen(N_Elements(a))+ 1
cgplot, b, a, /NoData, XRange=[0,Max(b)+1], XStyle=1
FOR j=0,N_Elements(a)-1 DO BEGIN
cgPlotS, [b[j],b[j]], [a[j],!Y.CRange[0]], Color='red', Thick=2
ENDFOR
END

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: plotting an array values keeping origin as a reference value
Next Topic: convert from Julian date to calendar date and vice verse

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

Current Time: Wed Oct 08 13:43:50 PDT 2025

Total time taken to generate the page: 0.00561 seconds