In the biplot
produced by the following code I am trying to get rid of the red lines. I would appreciate it if anyone could help.
library(psych)
data(bfi)
fa2 <- fa(bfi[16:25],2) #factor analysis
fa2$scores <- fa2$scores[1:100,] #just take the first 100
biplot(fa2,pch=c(24,21)[bfi[1:100,"gender"]],bg=c("blue","red")[bfi[1:100,"gender"]],
main="Biplot of Conscientiousness and Neuroticism by gender")
For whatever reason, the psych
library decided to re-write it's own biplot so it ignores many of the standard parameters. You can create your own version and just remove the arrow drawing. This method is somewhat hacky but tested with psych_1.4.5
. Just verify that
body(biplot.psych)[[c(11,3,12)]]
returns
arrows(0, 0, x$loadings[, 1L] * 0.8, x$loadings[, 2L] * 0.8,
col = col[2L], length = arrow.len)
to make sure we are changing the correct line. Then you can do
biplot.psych2<-biplot.psych
body(biplot.psych2)[[11]][[3]][[12]]<-NULL
And then call our new function with
biplot.psych2(fa2,pch=c(24,21)[bfi[1:100,"gender"]],
bg=c("blue","red")[bfi[1:100,"gender"]],
main="Biplot of Conscientiousness and Neuroticism by gender")
to get