More than six shapes in ggplot

后端 未结 3 679
北荒
北荒 2021-01-31 02:57

I would like to plot lines with different shapes with more than six sets of data, using discrete colors. The problems are 1) a different legend is generated for line color and

3条回答
  •  不要未来只要你来
    2021-01-31 03:51

    you can get about a hundred different shapes if you need them. good.shapes is a vector of the shape numbers that render on my screen without any fill argument.

    library(ggplot2)
    N = 100; M = 1000
    good.shapes = c(1:25,33:127)
    foo = data.frame( x = rnorm(M), y = rnorm(M), s = factor( sample(1:N, M, replace = TRUE) ) )
    ggplot(aes(x,y,shape=s ), data=foo ) +
        scale_shape_manual(values=good.shapes[1:N]) +
            geom_point()
    

提交回复
热议问题