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

Home » Public Forums » archive » Re: cursor command
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: cursor command [message #83785 is a reply to message #83784] Tue, 02 April 2013 17:23 Go to previous messageGo to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den onsdagen den 3:e april 2013 kl. 00:41:48 UTC+1 skrev gpet...@ucsc.edu:
>
> Okay, let me give you a summary of what I am trying to accomplish. I have created a contour plot from a 2 dimensional data set. Now I am trying to take image profiles of this data. So far the only way for me to get a profile is by just looking at my graph and estimating where the starting x and y locations and the ending x and y locations, thus I am trying to be more accurate using cursor.

I don't know what you mean by "image profile", but let's go through the program you've written:

> I think my question lies on how to properly separate the x and the y values from the 2d data array. I have done this
>
> openr, lun, 'arial.txt',/get_lun
> data=dindgen(824,914)
> readf, lun, data
> close,lun

OK, so you read a 2D array into "data".


> For i=0, 823 Do Begin
> FOR j=0, 913 Do Begin
> x=data(i,*)
> y=data(*,j)
> endfor
> endfor

Then you have a double for loop where you set x and y to the different rows and columns of data. But you never use those x and y for anything.


> window, 1, retain=2
> contour, rotatedata

Then you open a window and make a contour plot of some other variable, rotatedata, which we don't know where you get or what it looks like.


> While (!mouse.button Ne 4) DO BEGIN
> cursor, x, y, /data
> ENDWHILE

Then you enter a while loop, with a cursor command. The first time you click the mouse, the last row and column that you had in x and y will be replaced with the data coordinates at the location where the mouse pointer was positioned when you clicked. (Assuming cursor does work with contour, this will be x and y coordinates in the plot.)

But as far as I understand you can keep clicking away with the other two mouse buttons with no apparent effect, as this loop will not terminate until you click the rightmost mouse button, at which point the last position coordinates will be available in the x and y variables.


> However, when I try this nothing happens.

What mouse buttons did you click, if any?


> On the website you gave my I am not sure what this does in the example code they provide? could this be one section I am doing wrong?
>
> PLOTS,[X,X1], [Y,Y1], /NORMAL
> X = X1 & Y = Y1

In the example, before the while loop, the coordinates of a starting point (the first point where you click) is read with cursor. Then the while loop lets you keep clicking and it will draw lines from one point to the next for as long as you wish. When you want to stop drawing lines, you click the rightmost button and the loop will terminate after drawing the final line segment.

Why don't you run it?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: map_do_segments: map file: plow not found
Next Topic: How to parse the output of restore, filename, /ver

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

Current Time: Wed Oct 08 16:04:14 PDT 2025

Total time taken to generate the page: 0.00202 seconds