[R] biplot

Ben Bolker ben at zoo.ufl.edu
Fri Sep 7 21:50:27 CEST 2001

On Fri, 7 Sep 2001, Peter Lauren wrote:

> I have started using biplot() (with R1.3.0 on Windows) and have become very
> frustrated.  As far as I can see, I follow the directions but either it
> doesn't do what I want it to do, it gives fairly arcane error messages or
> both.  All I want to do is plot two separate data sets to see how different
> they are from each other with respect to two metrics that are represented by
> the two axes.
> My first problem is that biplot forms two axes: the bottom and left axes for
> the former data set and the top and right axes for the latter set.
> Invariably, these axes are scaled differently so it look like the data sets
> are easy to distinguish until I realise that they are plotted on different
> axes.  I try to make all the axes the same by doing

  I'm not sure, but it sounds to me like you may be trying to use a fairly
specialized tool to do something else.  You might want to just look into
using par(new=TRUE) to draw two plots with different axes on top of each

> >  biplot(former_set, latter_set,xlim <- 0:3,ylim <- 0:3)
> This sets the left and bottom axes to the required range but not the top or
> right axis.
> I also do not want the arrow heads, so I enter
> >   biplot(former_set, latter_set,arrow.len=0)
> I do not get the arrows but I do get the following error message.
> Error in arrows(x0, y0, x1, y1, length = length, angle = angle, code = code,
> :
>         invalid head length
> This depite the fact that the help for biplot says " The arrow head can be
> suppressed by `arrow.len = 0'.".

  This sounds like it may indeed be a bug.
  (Q to any developers who are reading: would it be a problem to make
zero-length arrows give a warning rather than an error?)  I can think of
two ways to work around it: (1) hack biplot.default to test whether
arrow.len equals 0, and only try to draw arrows if not (otherwise
segments() might work);  (2) set your arrow lengths to some ridiculously
small number.

> The program also does not appear to like it when I enter
> >    biplot(former_set, latter_set,var.axis=FALSE,colour)
> I get 11 warnings, all saying 'parameter "var.axis" couldn't be set in
> high-level plot() function' but the graph does not look any different.

  Shouldn't that be var.axes ???

> Also, colour does not appear to work.  I fill a vector, colour, with
> different numbers and check them with
> > colour
> to get
> > [1] 3 2
> but the colours are always black and red regardless of which numbers I
> enter.

  ??? How are you specifying this colo(u)r vector to biplot?  Are you
actually using the col= argument in the function call?

> I would be most grateful if someone could enlighten me on how to fix these
> problems.
> Thanks,
> Peter.
> _______________________________________________________
> http://inbox.excite.com
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list