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

Home » Public Forums » archive » problem with plot
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
problem with plot [message #56684] Mon, 12 November 2007 06:50 Go to next message
nakisa is currently offline  nakisa
Messages: 24
Registered: June 2007
Junior Member
Hi everybody
I am new in IDL , I want to plot data which restored in txt file and
plot by below code.


pro test
A_x=fltarr(1)
A_y=fltarr(1)
fn='F:\test.txt'
openr,1,fn
repeat begin
readf,1,x,y
;A_x(*)=x
;A_y(*)=y
plot,A_x,A_y
endrep until eof(1)
close,1
;plot ,A_x,A_y,PSYM=4,Title="test"
END


It runs ,but plot only a frame!! Can anybody say me where the error
is ?
Best,Nakisa
Re: problem with plot [message #56737 is a reply to message #56684] Wed, 14 November 2007 05:29 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
nakisa writes:

> I have two other questions:
> 1) how can I use color in plots, I see some commands ,but most of them
> doesn't agree with "plot " . I want to draw three plots with different
> colors in one frame, I know "oplot" do this for me, but I can't
> specify each plot a one color! What should I do?

The one color you have doesn't happen to be red, does it?
I would guess a DEVICE, DECOMPOSED=0 might help. Otherwise,
there is a LOT of color information on my web page.

> 2) I have a 3 dimensional data, (x,y,z) , is there any way to plot a
> contour of these data ? for using contour and mesh , z must bas 2
> dimensional array. But here I have only one dimensional array for z .
> I write "contour z,x,y " IDL doesn't run.

If your version of IDL supports it, you can try setting
the IRREGULAR keyword on your contour command. Otherwise,
you will have to grid the data yourself with TRIANGULATE
and TRIGRID.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: problem with plot [message #56741 is a reply to message #56684] Wed, 14 November 2007 02:18 Go to previous messageGo to next message
nakisa is currently offline  nakisa
Messages: 24
Registered: June 2007
Junior Member
Hi again
I have two other questions:
1) how can I use color in plots, I see some commands ,but most of them
doesn't agree with "plot " . I want to draw three plots with different
colors in one frame, I know "oplot" do this for me, but I can't
specify each plot a one color! What should I do?

2) I have a 3 dimensional data, (x,y,z) , is there any way to plot a
contour of these data ? for using contour and mesh , z must bas 2
dimensional array. But here I have only one dimensional array for z .
I write "contour z,x,y " IDL doesn't run.
Best, Nakisa
Re: problem with plot [message #56746 is a reply to message #56684] Tue, 13 November 2007 18:38 Go to previous messageGo to next message
nakisa is currently offline  nakisa
Messages: 24
Registered: June 2007
Junior Member
hi
I try " COUNT_ROWS " function , it works nicely and give answer very
soon.
thanks,nakisa
Re: problem with plot [message #56763 is a reply to message #56684] Tue, 13 November 2007 09:01 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Allan Whiteford writes:

> I'd prefer:
>
> pro test
> plot,((_=read_ascii("F:\test.txt"))).(0)[0,*],_.(0)[1,*]
> end
>
> but I'm not paid by the number of lines of code I write :).
>
> In all seriousness, though, is there a reason to avoid read_ascii for
> things like this or were you just trying to use as much of the original
> structure as possible?

I was really trying to use this as a teachable moment for
the "IDL Way". :-)

READ_ASCII is great if you have 10 or 100 rows of data.
It is slow, slow, slow if you have a LOT of rows. This is
because it, by necessity, has to use the line by line
data reading method.

Plus, it so damn inelegant (IMHO) I've never used it, so
I just never think about it as a solution. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: problem with plot [message #56770 is a reply to message #56684] Mon, 12 November 2007 21:36 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
nakisa writes:

> I use 5.4 version, and as far as i searching thorough internet ,
> "file_lines" works in 5.6 version.
> so i can't use it !!

Ah, well. Try COUNT_ROWS here:

http://www.dfanning.com/programs/count_rows.pro

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: problem with plot [message #56795 is a reply to message #56684] Fri, 16 November 2007 06:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nakisa writes:

> I need to plot something what vel.pro plots but not precisely it.
> I must plot on each (x, y) a vector with (v_x , v_y ) values. In vel
> and other IDL's function the value of vector on each point is
> constant, but here in my plot, the value of vector are important .
> Can you guide me ?

http://www.dfanning.com/graphics_tips/vectors.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: problem with plot [message #56796 is a reply to message #56737] Fri, 16 November 2007 06:11 Go to previous messageGo to next message
nakisa is currently offline  nakisa
Messages: 24
Registered: June 2007
Junior Member
Hi david,thanks of the pervious answer.

I need to plot something what vel.pro plots but not precisely it.
I must plot on each (x, y) a vector with (v_x , v_y ) values. In vel
and other IDL's function the value of vector on each point is
constant, but here in my plot, the value of vector are important .
Can you guide me ?
Best, Nakisa
Re: problem with plot [message #56881 is a reply to message #56795] Sat, 17 November 2007 04:23 Go to previous message
nakisa is currently offline  nakisa
Messages: 24
Registered: June 2007
Junior Member
thanks David, it works very good.
nakisa
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: capital letters in file names?
Next Topic: Multi-plot error. Could anyone help me?

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

Current Time: Fri Oct 10 11:24:33 PDT 2025

Total time taken to generate the page: 1.04640 seconds