Re: cursor,xi,yi,/normal [message #61090 is a reply to message #61089] |
Thu, 03 July 2008 05:03   |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Jul 3, 12:23 pm, d.po...@gmail.com wrote:
> On Jul 3, 1:04 pm, Spon <christoph.b...@gmail.com> wrote:
>
>> On Jul 3, 11:40 am, David Fanning <n...@dfanning.com> wrote:
>
>>> Spon writes:
>>>> I was about to point Dave to David Fanning's ANNOTATEWINDOW, but I
>>>> can't get it to work, even after updating my Coyote library.
>
>>>> I get the following error:
>>>> % Attempt to call undefined procedure/function: 'COLORTOOL__DEFINE'.
>>>> % Error occurred at: ANNOTATEWINDOW 186
>
>>>> Searching David's site and the IDL helpfiles, I can't seem to find
>>>> mention of the ColorTool object class anywhere. What am I missing?
>
>>> Are you sure you are using the latest catalyst.sav version?
>>> I did, long ago, have a version out there there was missing
>>> this Catalyst Library object. But the latest appears to have
>>> it.
>
>>> I should probably update this, as I have made lots of changes
>>> lately, but I'm enjoying the beach this week. :-)
>
>>> Cheers,
>
>>> David
>>> --
>>> David Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Coyote's Guide to IDL Programming (www.dfanning.com)
>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>> Thanks, that's got it. Enjoy your holiday David!
>> C
>
> Chris
> i have got that error also. how we can fix it?
> Dave
I just fixed it by downloading the latest version of David's entire
library from
http://www.dfanning.com/programs/coyoteprograms.zip
Into a folder on my !Path
I guess I also restored the analyst.sav file, but I'm not sure if
that's necessary if you have everything set up right:
CD, [Coyote Library Folder]
RESTORE, 'analyst.sav'
Regards,
Chris
PS Here's a simple version of what I use to do what I think you want.
It's not efficient, with all those Wait calls and unnecessary
concatenations, but it works:
Function GraphArray, X, Y
Window, /Free, Title = $
'Left click to store values, right click when done.'
WIndex = !Window
Loop:
Plot, X, Y
Cursor, xp, yp, /Data, /Down
; Right button or kill/change window to quit:
If !Mouse.Button Eq 4 Or !Window NE WIndex Then Begin
Print, 'Returning.'
If !Window Eq WIndex Then WDelete
If N_elements(Array) Eq 0 Then Return, 0
Return, Transpose(Array)
Endif
; Draw X where user clicked
OPlot, [0,xp], [0,yp], PSym=2
; Work out nearest point on graph line
XDiffs = Abs(X - xp)
YDiffs = Abs(Y - yp)
Diffs = XDiffs + YDiffs
Void = Min(Diffs, Index)
NX = X[Index]
NY = Y[Index]
NearPt = [ NX, NY ]
; Draw a diamond on actual datapoint stored to array.
OPlot, [0,NX], [0,NY], PSym=4
Wait, 1.5
; Store values
If N_Elements(Array) Eq 0 Then $
Array = Transpose(NearPt) Else $
Array = [Array, Transpose(NearPt)]
Goto, Loop
End
|
|
|