[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: draw text parallel to a sloping line



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,/TO_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]