Re: [R] Adding data labels to Lattice plots

From: David Hewitt <dhewitt_at_vims.edu>
Date: Wed, 12 Dec 2007 16:57:53 -0800 (PST)

> I am new to lattice graphics...
>

Me too, for the most part, so this might not be great advice.

> print(xyplot(MeanScore ~ PointsInTime, d2, groups = cat, type = 'o',
> xlab = "Points in Time", ylab = "Mean Score", aspect = 0.7,
> auto.key = list(points = TRUE, lines = TRUE, space = "right")))
>

This will get the labels on the points, but you need a way to avoid overlapping labels. And the xyplot is not maintaining the lines and grouping in this new arrangement.

panel1 = function(x, y) {

     panel.xyplot(x, y)
     panel.text(PointsInTime, MeanScore,
          labels=round(MeanScore, digits=2), pos=2, offset=0.8)
     }

xyplot(MeanScore ~ PointsInTime, data=stuff, groups=cat, type='o',
        xlab = "Points in Time", ylab = "Mean Score", aspect = 0.7,
        auto.key = list(points = TRUE, lines = TRUE, space = "right"),
        panel=panel1)



David Hewitt
Virginia Institute of Marine Science
http://www.vims.edu/fish/students/dhewitt/
-- 
View this message in context: http://www.nabble.com/Adding-data-labels-to-Lattice-plots-tp14297921p14307638.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Thu 13 Dec 2007 - 01:03:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 13 Dec 2007 - 01:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.