Dear r-help, the prcomp matrix (x$rotation) I have, has the columns labels as chemical formulas (i.e: C2H3, 37Cl,...,C10H24N3O3). Plotting them as plain text I do the following with success: xlabs <- dimnames(y$rotation)[[1]] xlabs <- as.character(xlabs) plot(y$rotation[,1],y$rotation[,2], ann=FALSE, type="p", col="red", pch=20) text(y$rotation[,1],y$rotation[,2], labels=xlabs, cex=0.7, font=1, pos=4, offset=0.2) I do not succed to plot the labels with subscripts and superscripts. I did many attempt trying with expression() or substitute() but without success. I can write the labels in the data matrix as needed (i.e.: C[2]*H[3]) to plot properly if I would know how. I peg your pardon if this is probably a silly problem, I am new user of R (I am using R 1.7.0 on win2k). Many thanks in advance for any help. Roberto Roberto Canteri Research Scientist Physics-Chemistry of Surfaces and Interfaces Division | ITC-irst | Tel. (+39) 0461 314 486 Centre for the scientific and technological research | Fax (+39) 0461 810 851 Via Sommarive, 18 | E-mail: canteri at itc.it 38050 Povo - TRENTO - Italy | Web Page: http://www.itc.it/
Dear r-help, the prcomp matrix (x$rotation) I have, has the columns labels as chemical formulas (i.e: C2H3, 37Cl,...,C10H24N3O3). Plotting them as plain text I do the following with success: xlabs <- dimnames(y$rotation)[[1]] xlabs <- as.character(xlabs) plot(y$rotation[,1],y$rotation[,2], ann=FALSE, type="p", col="red", pch=20) text(y$rotation[,1],y$rotation[,2], labels=xlabs, cex=0.7, font=1, pos=4, offset=0.2) I do not succed to plot the labels with subscripts and superscripts. I did many attempt trying the use of expression() or substitute() but without success. I can write the labels in the data matrix as needed (i.e.: C[2]*H[3]) to plot properly if I would know how. I peg your pardon if this is probably a silly problem, I am new user of R (I am using R 1.7.0 on win2k). Many thanks in advance for any help. Roberto Roberto Canteri Research Scientist Physics-Chemistry of Surfaces and Interfaces Division | ITC-irst |Tel. (+39) 0461 314 486 Centre for the scientific and technological research | Fax (+39) 0461 810 851 Via Sommarive, 18 | E-mail:canteri at itc.it 38050 Povo - TRENTO - Italy | Web Page: http://www.itc.it/