How to add a condition to the geom_point size?

后端 未结 2 406
鱼传尺愫
鱼传尺愫 2020-12-03 08:53

I am trying to add a condition to geom_point size and I\'ve pasted my example below. I would like geom_point size to be 2 when n_in_stat is 4 or more, and size = 5 when n_i

2条回答
  •  鱼传尺愫
    2020-12-03 09:30

    also you can just use a function:

    ff <- function(x){ifelse(x < 4, 5, 2)}
    

    and then change

    geom_point(aes(size = n_in_stat)) +
    

    with

    geom_point(aes(size = ff(n_in_stat))) +
    

提交回复
热议问题