I have read the thread re: "Plotting text with lattice" but can't seem to get from there to what I need. . . would appreciate any advice. . .

I have used splom to plot data of the first three principle components from a pca analysis. Here is the code I have thus far:

> mydata.pr<-prcomp(mydata)
> grps <- substr(rownames(mydata),1,4)
> super.sym=trellis.par.get("superpose.symbol")
> splom(data.frame(mydata.pr$x[,1:3]),
        groups = grps,
        panel = panel.superpose,
        key = list (title = "Four Items in PCA space",
                text = list(c("G", "H", "N", "Il")),
                points=list(pch=super.sym$pch[1:4],
                col=super.sym$col[1:4])))

I would now like to append text labels to each point in the plot that will identify the item based on its rowname in the original data set.

so, something like this gets me the labels I want

> labs<-substr(rownames(mydata),1,6)

My trouble then comes in figuring out how to get these labels to "attach" to the corresponding points in the plot.

Thanks.
Matt

--
Matthew Jockers
Stanford University
http://www.stanford.edu/~mjockers

______________________________________________
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