如何将白色边框添加到彩色的Geom_Point

时间:2020-04-25 19:08:22

标签: r ggplot2 tidyverse

我正在阅读https://r4ds.had.co.nz/data-visualisation.html。练习3.6.1。要求创建这个

enter image description here

我尝试了fill = drv

library(tidyverse)
ggplot(mpg, aes(x = displ, y = hwy)) +
  geom_point(shape = 21, colour = "white", fill = drv, size = 5, stroke = 5)

fill = factor(drv)

ggplot(mpg, aes(x = displ, y = hwy)) +
  geom_point(shape = 21, colour = "white", fill = factor(drv), size = 5, stroke = 5)

并得到错误

找不到对象“ drv”

0 个答案:

没有答案