Assigning 40 shapes or more in scale_shape_manual

前端 未结 3 1305
时光取名叫无心
时光取名叫无心 2021-01-03 04:10

I have a data frame with more than 40 factor levels and I would like to assign different shapes for each level. However, as shown in the scale_shapes_table of ggplot2<

3条回答
  •  一整个雨季
    2021-01-03 04:56

    Would using a combination of 5 or 10 distinct shapes with distinct colors sufficient to distinguish the 40 points work better? I see these as being visually easier to differentiate the 40 elements than using/resorting to unusual symbols.

    ggplot(data=data,aes(x=x1,y=y1, shape=factor(gr), col=factor(gr)))+
     geom_point(alpha = 0.5, size=4, stroke=1.4) +
     scale_shape_manual(values=rep(c(0:2,5:6,9:10,11:12,14), times=4))
    

    Or take advantage of the 5 unique shapes that take fill colors.

    ggplot(data=data,aes(x=x1,y=y1, shape=factor(gr), fill=factor(gr), col=factor(gr)))+
     geom_point(alpha = 0.5, size=4, stroke=1.4) +
     scale_shape_manual(values=rep(c(21:25), times=8))
    

提交回复
热议问题