View source: R/BP_Plot_Scores.R
BP_Plot_Scores | R Documentation |
Generates a biplot of scores from PCA with color coding of points, point labels and ellipses around data groups. Returns some parameters for easy replotting when zooming for example. If ax1 and ax2 are identical, plots a histogram of scores.
BP_Plot_Scores( ax1, ax2 = NULL, pcs, frac, xlimits = NULL, ylimits = NULL, colorby = rep(2, length(ax1)), pt.label = NULL, ell_option )
ax1 |
horizontal axis value of scores |
ax2 |
vertical axis value of scores |
pcs |
2 element vector giving the PC number for ax1 and ax2 respectively for axis labelling |
frac |
2 element vector giving the % variance explained for PC on ax1 and ax2 respectively. For axis labelling. |
xlimits |
2 element vector giving the minimum and maximum value of the horizontal axis. |
ylimits |
2 element vector giving the minimum and maximum value of the vertical axis. |
colorby |
class for color coding of points. Default is all blue. When default, no legend is plotted. |
pt.label |
label for points. NA is used to skip a labels. |
ell_option |
option for plotting confidence ellipse around groups of points. "None", "0.50" or "0.95" Will be done only if there is more than one group defined by colorby. |
A list with the following elements:
Xsc,Ysc : x and y values of all scores plotted.
pcs : number of x and y axis principal comp.
X_Lim, Y_Lim : xlim and ylim of current plot.
colorby : class for color coding of points.
pt.label : label for points. NA is used to skip a labels.
ell_option : option for plotting confidence ellipse around groups of points. "None", "0.50" or "0.95" Will be done only if there is more than one group.
BP_Plot_Scores(ax1=c(rnorm(20,10,2),rnorm(20,20,3)), ax2=rnorm(40,5,3), pcs=c(1,2), frac= c(81.2,9.8), colorby=as.factor(c(rep("Cl1",20),rep("Cl2",20))), ell_option="0.5")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.