On 2010-07-19 7:50, Shawn Way wrote:
Sorry about not answering sooner and providing code.  My company mail
server died this weekend and I could respond without creating a new
account on r-help.

The package I'm using is pcaMethods (1.12)(found in the bioconductor
packages).  The following runs

==============================
data(iris)
pcIr<- pca(iris[,1:4], method="nipals", nPcs=3, cv="q2")
slplot(pcIr, sl=as.character(iris[,5]),scoresLoadings=c(TRUE, FALSE))

==============================

and a chart is created.

What I would like to do is scale the xlim and ylim such that the x and y
scales are the same.

I used

==============================
slplot(pcIr, sl=as.character(iris[,5]),scoresLoadings=c(TRUE, FALSE),
xlim=c(-8,8),ylim=c(-8,8))
==============================

to no avail...

Any thoughts?

Shawn,
I can't see how to do what you want with slplot() without
modifying the code. You might have better luck on the
bioconductor list.

But you can always generate the scores plots yourself.
Here are two ways:

## 1. uses base graphics
# make a dataframe of scores
sc <- as.data.frame(scores(pcIr))
str(sc)

# set up the plot of PC2 vs PC1; don't plot the points
with(sc, plot(PC1, PC2, type = 'n', xlim = c(-8,8), ylim = c(-8,8)))

# add text at the point locations
with(sc, text(PC1, PC2, iris[,5], cex = 0.5))

# add lines
abline(h = 0, v = 0)

## 2. use lattice
xyplot(PC2 ~ PC1, data=sc, type="n",
       xlim = c(-8, 8), ylim = c(-8, 8),
       panel=function(x, y, ...){
             panel.xyplot(x, y, ...)
             panel.text(x, y, labels = iris[,5], cex = 0.5)
             panel.abline(h = 0, v = 0)
       }
)

  -Peter Ehlers


Thank you kindly,

--------------------------------------------------------------
Shawn Way, PE
MECO, Inc.
(p) 281-276-7612
(f)  281-313-0248

[....]

______________________________________________
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