problem with plot [message #56684] |
Mon, 12 November 2007 06:50  |
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   |
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   |
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 #56763 is a reply to message #56684] |
Tue, 13 November 2007 09:01   |
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/
|
|
|
|
|
|
|