Only 32 of the 90 legends that appeared on the screen on a plot created using ggplot

I mainly create a PCA scatter plot. I have 90 different population groups. Each population is represented by a different form. Creating a scatter plot seems simple, but all my legends are not displayed on the screen. The basic formula that I use is

qplot(data=dat, x=dat[,1], y=dat=[1[, color= factor (dat[,11]), 
      shape= factor(dat[,11])) + scale_shape_manual(values=27:132)

The formula works for small populations. However, how do I make legends smaller and fit into the screen?

+3
source share
2 answers

Here is a solution using latticeExtra(to get ggplot2as a theme), but good luck discerning 90 colors :) (I would try some rcharts-intercat graphs)

enter image description here

library(directlabels)
set.seed(1)
n = 1000
N = 90
dat = data.frame(x=runif(n,1,10),
                 y=runif(n,1,10),
                 col=paste0('pop',gl(N,n/N)))
library(latticeExtra)
xyplot(y~x,data=dat,groups=col,
       auto.key=list(columns=10),
       par.settings = ggplot2like(), axis = axis.grid)
+1
source

Besides the comments above, have you tried some large number of lines and placed the legend at the bottom? for instance

(fill = guide_legend (nrow = 25))

0
source

All Articles