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

Home » Public Forums » archive » Problem with PLOT_OO ticks
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: problem with plot [message #56765 is a reply to message #56683] Tue, 13 November 2007 08:22 Go to previous messageGo to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
David Fanning wrote:
> nakisa writes:
>
>
>> 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
>
>
> Oh, dear. How about something like this:
>
> PRO test
> datafile = 'F:\test.txt'
> rows = File_Lines(datafile)
> data = FltArr(2,rows)
> OpenR, lun, datafile, /Get_LUN
> ReadF, lun, data
> Free_Lun, lun
> x = Reform(data[0,*])
> y = Reform(data[1,*])
> Plot, x, y
> END
>
> Cheers,
>
> David
>

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?

Thanks,

Allan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: linfit and regress questions
Next Topic: Re: Using .evf files programmatically

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

Current Time: Fri Oct 10 18:34:44 PDT 2025

Total time taken to generate the page: 1.68056 seconds