Dr. Harrell's Hmisc package has labcurve.

--Matt

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ted Harding
Sent: Wednesday, July 16, 2008 1:17 PM
To: [EMAIL PROTECTED]
Subject: [R] Labelling curves on graphs

Hi Folks,
I'd be grateful for good suggestions about the following.

I'm plotting a family of (X,Y) curves (for different levels of another 
variable, Z): say 6 curves in all but could be more or less -- it's a rather 
variables situation.

I'd like to label each curve with the value of Z that it corresponds to.

The problem is that the layout (shapes, spacings, ranges of X over which non-NA 
values of Y get plotted) of the curves are very variable, and somewhat 
unpredictable beforehand.

Of course one could simply wait until the graph was done, and then by hand 
position one's labels to the best effect.
That, given time, is on a certain sense the optimum solution.
But I'd like to be able to do a satisfactory job automatically, and quickly!

This is the sort of problem already solved, in one particular way, in 
contour(). But here the curves are broken at the labels and the labels are 
centred on the curves (though nicely aligned with the curves).

It might be satisfactory for me to place each label so that its baseline is on 
its curve, thus without overlaying the curve with the text. So maybe a 
"displaced" analogue of the way contour() does it (including alignment of the 
text) may be OK.

Anothe possibility, for instance, is to draw lines from the ends of the curves 
to antries in a plotted table of Z-values. This could end up looking very 
untidym, though.

I grant that this is a vague query. I'm still trying to form a clear view of 
how it ought to be approached; and I don't have R code to refer to and 
experiment with (that of contour() is hidden in its "method").

But people out there must have faced it, and I'd be grateful for their own 
feedback from the coal-face!

With thanks,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 16-Jul-08                                       Time: 21:17:13
------------------------------ XFMail ------------------------------

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to