srt relative to figure

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

srt relative to figure

ivo welch-2
Dear R wizards:

I would love to write a general function that matches the slope of a plotted
line in an xy-plot at a particular x,y location.  something like

   x<- (1:10)^2; y<- 40:50;
   plot( x,y, type="l", xlim=c(0,90) )
   srt.at5 = text.at.current.plot.with.slope( x, y,  5);
   text( x[5],y[5], pos=3, srt=srt.at.5);

to do this, I first need to compute the function slope around x[5], which is
an easy task.  alas, the harder task is that I need to scale this by the
plot aspect ratio and the axes.  How can a function read this from the
current plot?

(Has someone written such a function, perhaps more embellished, to save me
the debugging effort?)

Or, is there an alternative to srt, which slopes the text relative to the
existing scale?

help appreciated.

sincerely,

/ivo welch

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html