Dear R-help fellows good afternoon. I am struggling in the attempt to impose some graphical conditions (changing point symbols, colors, etc) to biplot function (I am using it to visualize the results of princomp) but I can't apparently manage to change anything but the axis... and I have been browsing manuals and vignettes without finding any explicit suggestions on how to operate... Can anyone, please, point my attention to the relevant documentation? Thank you in advance and best regards, Marco -- Marco Manca, MD University of Maastricht Faculty of Health, Medicine and Life Sciences (FHML) Cardiovascular Research Institute (CARIM) PO Box 616 6200 MD Maastricht E-mail: m.manca at path.unimaas.nl Office telephone: +31(0)433874633 Personal mobile: +31(0)626441205 Twitter: @markomanka ********************************************************************************************************************* This email and any files transmitted with it are confide...{{dropped:15}}
Meyners, Michael, LAUSANNE, AppliedMathematics
2009-Sep-02 12:14 UTC
[R] "biplot" graphical options?
Taking the example from ?biplot.princomp with reproducible code (hint, hint): biplot(princomp(USArrests)) biplot(princomp(USArrests), col=c(2,3), cex=c(1/2, 2)) clearly changes the color and font size on my system. For changing the "point symbols" (which are text by default), try setting xlabs and ylabs. But of course, an argument "pch" will not have any effect, as biplot does have no call to "points" or similar, but to "text" only (and hence mainly parameters of "text" will have an effect on what you aim at). So for documentation, I'd propose ?biplot.princomp and ?biplot.default. For changes that are truly impossible (there are indeed some), take the code for biplot.default (or biplot.princomp) and amend where necessary to fulfill your needs. HTH, Michael> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Manca Marco (PATH) > Sent: Mittwoch, 2. September 2009 13:02 > To: r-help at r-project.org > Subject: [R] "biplot" graphical options? > Importance: High > > > Dear R-help fellows > > good afternoon. > > I am struggling in the attempt to impose some graphical > conditions (changing point symbols, colors, etc) to biplot > function (I am using it to visualize the results of princomp) > but I can't apparently manage to change anything but the > axis... and I have been browsing manuals and vignettes > without finding any explicit suggestions on how to operate... > > Can anyone, please, point my attention to the relevant documentation? > > Thank you in advance and best regards, > Marco > > -- > Marco Manca, MD > University of Maastricht > Faculty of Health, Medicine and Life Sciences (FHML) > Cardiovascular Research Institute (CARIM) PO Box 616 6200 MD > Maastricht > > E-mail: m.manca at path.unimaas.nl > Office telephone: +31(0)433874633 > Personal mobile: +31(0)626441205 > Twitter: @markomanka > > > ************************************************************** > ******************************************************* > > This email and any files transmitted with it are > confide...{{dropped:15}} > > ______________________________________________ > 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. >
Hi I had similar problem some time ago. I was advised to use eqscplot but it did not suite my purpose so I used a little twist of biplot. (I added a result) fit<-princomp(some.data, cor=T) biplot(fit, xlabs=rep("", no.of.poins)) #biplot without points #some scaling of plot parameters rrr<-apply(fit$scores[,1:2],2, range) (abs(rrr)+.1)*sign(rrr) par(usr=as.vector(rrr)) # plot the points according to some leves points(fit$scores[,1:2], col=jet.colors(11)[(as.numeric(kvalita.ag$typ[cc]))], pch=20) So my advice is to plot without points and then add points from fit and treat them in usual way (pch, col, cex, ...) Or you could modify source code for biplot and create your own, which could by quite tricky. Regards Petr r-help-bounces at r-project.org napsal dne 02.09.2009 13:02:27:> > Dear R-help fellows > > good afternoon. > > I am struggling in the attempt to impose some graphical conditions(changing> point symbols, colors, etc) to biplot function (I am using it tovisualize the> results of princomp) but I can't apparently manage to change anythingbut the> axis... and I have been browsing manuals and vignettes without findingany> explicit suggestions on how to operate... > > Can anyone, please, point my attention to the relevant documentation? > > Thank you in advance and best regards, > Marco > > -- > Marco Manca, MD > University of Maastricht > Faculty of Health, Medicine and Life Sciences (FHML) > Cardiovascular Research Institute (CARIM) > PO Box 616 > 6200 MD Maastricht > > E-mail: m.manca at path.unimaas.nl > Office telephone: +31(0)433874633 > Personal mobile: +31(0)626441205 > Twitter: @markomanka > > >*********************************************************************************************************************> > This email and any files transmitted with it areconfide...{{dropped:15}}> > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
Hi, You can make a biplot on Your own, it is not so hard. And in this case You can change parameters for every low level function as You wish. PC <- prcomp (iris[,1:4]) lambda <- PC$sdev * sqrt(nrow(PC$x)) plot (t(t(PC$x)/lambda),pch=16,col=as.numeric(iris[,5])) par (new=T) Rot <- t(t(PC$rotation)*lambda) XLIM <- c(-max(abs(Rot[,1])),max(abs(Rot[,1]))) XLIM <- XLIM+(XLIM*0.1) plot(Rot,col=4,axes=FALSE,xlim=XLIM,ylim=XLIM,pch="") arrows (rep(0,nrow(PC$rotation)),rep(0,nrow(PC$rotation)),Rot[,1],Rot[,2],col=4) text (Rot[,1:2],rownames(Rot),col=6) axis (3) axis (4) Best regards, Andris On Wed, Sep 2, 2009 at 1:02 PM, Manca Marco (PATH)<m.manca at path.unimaas.nl> wrote:> > Dear R-help fellows > > good afternoon. > > I am struggling in the attempt to impose some graphical conditions (changing point symbols, colors, etc) to biplot function (I am using it to visualize the results of princomp) but I can't apparently manage to change anything but the axis... and I have been browsing manuals and vignettes without finding any explicit suggestions on how to operate... > > Can anyone, please, point my attention to the relevant documentation? > > Thank you in advance and best regards, > Marco > > -- > Marco Manca, MD > University of Maastricht > Faculty of Health, Medicine and Life Sciences (FHML) > Cardiovascular Research Institute (CARIM) > PO Box 616 > 6200 MD Maastricht > > E-mail: m.manca at path.unimaas.nl > Office telephone: +31(0)433874633 > Personal mobile: +31(0)626441205 > Twitter: @markomanka > > > ********************************************************************************************************************* > > This email and any files transmitted with it are confide...{{dropped:15}} > > ______________________________________________ > 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. >
Manca Marco (PATH <m.manca <at> path.unimaas.nl> writes: .> I am struggling in the attempt to impose some graphical conditions (changingpoint symbols, colors, etc)> to biplot function (I am using it to visualize the results of princomp) but Ican't apparently manage to> change anything but the axis... and I have been browsing manuals and vignetteswithout finding any> explicit suggestions on how to operate... > > Can anyone, please, point my attention to the relevant documentation?Howdy, The relevant documentation in this case is ?biplot. The documentation to the specific method is less useful (?biplot.princomp). That documentation tells you that you can't do what you want to do. No choice. For instance, col (for colour) can be of length 2 giving different colours for each set of points, but you cannot vary the colour within the set. Further, you cannot turn off using arrows and text or even suppress the plotting and add your own points. If you use RSiteSearch("biplot"), you can find some packages with more flexibility than stats:::biplot.princomp and stats:::biplot.default. Another alternative is to write your own biplot function or do the plot by hand using the basic commands. Best wishes, Jari Oksanen