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

Home » Public Forums » archive » Re: draw text parallel to a sloping line
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: draw text parallel to a sloping line [message #19194 is a reply to message #19193] Sat, 04 March 2000 00:00 Go to previous message
kashyap is currently offline  kashyap
Messages: 26
Registered: April 1993
Junior Member
It doesn't work because >orientation< in XYOUTS does not know
anything about the previous PLOT and the data ranges in the
plot. Do the following:

X = 24.5259 & Y = 16789.1 & Slope = -1763.03 ; data coordinates
dX=2.2 & plot, [X-dX,X+dX], Y+[-dX,dX]*Slope
;{convert slope from data to device coordinates
DATA_XY=convert_coord(X+DX*[-1,1],Y+DX*SLOPE*[-1,1],/DATA,/T O_DEVICE)
DATA_DY=DATA_XY(1,1)-DATA_XY(1,0) & DATA_DX=DATA_XY(0,1)-DATA_XY(0,0)
O_angle=atan(DATA_DY,DATA_DX)*!radeg
;end changes}
xyouts,X,Y,'A_String_Parallel_To_A_Line',align=0.5,orient=O_ angle

vinay

In article <38C1644C.FB280C52@risoe.dk>,
Kristian Kjaer <kristian.kjaer@risoe.dk> wrote:
> I want to draw some text parallel to a sloping line, e.g.,
> the line through (X,Y) with a given Slope:
>
> IDL> X = 24.5259 & Y = 16789.1 & Slope = -1763.03 ; data coordinates
> IDL> dX=2.2 & plot, [X-dX,X+dX], Y+[-dX,dX]*Slope
>
> Then this doesn't give the desired result:
>
> IDL> O_angle=atan(Slope)*!radeg
> IDL> xyouts,X,Y,'A_String_Parallel_To_A_Line',$
> IDL> alignment=0.5,orientation=O_angle
>
> But then, how to do?
> Any help appreciated!


--
____________________________________________________________ __________________
kashyap@head-cfa.harvard.edu 617 495 7173 [CfA/P-146] 617 496 7173 [F]
[Message index]
 
Read Message
Read Message
Previous Topic: Getting rid of loops
Next Topic: xyouts character size to scale with the size of the plot window

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

Current Time: Sat Oct 18 13:45:28 PDT 2025

Total time taken to generate the page: 1.59993 seconds