projAxes              package:flexclust              R Documentation

_A_d_d _A_r_r_o_w_s _f_o_r _P_r_o_j_e_t_e_d _A_x_e_s _t_o _a _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     Adds arrows for original coordinate axes to a projection plot.
     Currently only a method for the results of 'prcomp' exists.

_U_s_a_g_e:

     projAxes(object, which=1:2, center=NULL,
                          col="red", radius=NULL,
                          minradius=0.1, textargs=list(col=col),
                          col.names=getColnames(object),
                          which.names="", group = NULL, groupFun = colMeans,
                          ...)

     placeLabels(object)
     ## S4 method for signature 'projAxes':
     placeLabels(object)

_A_r_g_u_m_e_n_t_s:

  object: Return value of a projection method like 'prcomp'.

   which: Index number of dimensions of (projected) input space that
          have been plotted.

  center: Center of the coordinate system to use in projected space.
          Default is the center of the plotting region.

     col: Color of arrows.

  radius: Relative size of the arrows.

minradius: Minimum radius of arrows to include (relative to arrow
          size).

textargs: List of arguments for 'text'.

col.names: Variable names of the original data.

which.names: A regular expression which variable names to include in
          the plot.

   group: An optional grouping variable for the original coordinates.

groupFun: Function used to aggregate the projected coordinates if
          'group' is specified.

     ...: Passed to  'arrows'.

_V_a_l_u_e:

     'projAxes' returns an object of class '"projAxes"', which is added
     to the current plot by its 'show' and 'plot' method.

_A_u_t_h_o_r(_s):

     Friedrich Leisch

_E_x_a_m_p_l_e_s:

     data(milk)
     milk.pca <- prcomp(milk, scale=TRUE)

     ## create a biplot step by step
     plot(predict(milk.pca), type="n")
     text(predict(milk.pca), rownames(milk), col="green", cex=0.8)
     projAxes(milk.pca)

     ## the same, but arrows are blue, centered at origin and all arrows are
     ## plotted 
     plot(predict(milk.pca), type="n")
     text(predict(milk.pca), rownames(milk), col="green", cex=0.8)
     projAxes(milk.pca, col="blue", center=0, minradius=0)

     ## use points instead of text, plot PC2 and PC3, manual radius
     ## specification, store result
     plot(predict(milk.pca)[,c(2,3)])
     arr <- projAxes(milk.pca, which=c(2,3), radius=1.2)
     plot(arr)

