如果满足条件,我正在寻找一种填充 geom_point 的方法
例子:
mydata <- tibble(x_var = 1:5,
y_var = runif(5),
category_a = c('yes', 'yes', 'no', 'no', 'yes'),
category_b = c('down', 'up', 'up', 'down', 'down')
)
ggplot(mydata,
aes(x = x_var,
y = y_var,
color = category_a,
)
) +
geom_point(shape = 21,
size = 5,
stroke = 2
)
我想将满足条件的点category_b == 'down'
用相同的颜色category_a
填充,其余的不填充,我该怎么做?问候!