rpcaprincomp

Remove top and right axis in princomp plot


I have a little problem, I want to remove the top and right axes (I don't know what's the name of that axis, sorry) of my PCA biplot, but I can't figure out how to do it.

Is there a way to remove it?

I read that bty=1 works to have only the left and bottom axes, but it doesn't work.

biplot(PC.LC50, col=2:6, xlab="1st Principal Component (71.2%)", ylab="2nd Principal Component (15.9%)",  xlabs=c("Puerto Colombia", "Soledad", "Barranquilla", "Valledupar", "San Juan", "Sincelejo", "Monteria", "Cienega", "Cartagena"), pch=21, cex=0.75, xlim=c(-0.6,1),bty=1)
#Error en plot.window(...) : invalid value specified for graphical parameter "bty"

I tried using it separately:

par(bty="1")
#Error en par(bty = "1") : invalid value specified for graphical parameter "bty"

I don't know how to use that command, or if it is the one to remove the top and right axes.


Solution

  • Try this. It seems biplot accepts the axes argument. I cut out some of your original code so it's easy to see what I did. The at in axis(1, ...) is the xlim value from the original plot

    biplot(PC.LC50, axes = FALSE)
    axis(1, at = c(-0.6,1))
    axis(2)
    box()