通常,fill 定义了一个几何图形填充的颜色,而 colour 定义了一个几何图形的轮廓颜色(形状的“笔触”,使用 Photoshop 语言)。
点一般只有颜色而没有填充,因为,你知道——它们只是点。但是,point shapes 21–25 that include both a colour and a fill。例如:
library(tidyverse)
df = data_frame(x = 1:5, y = x^2)
ggplot(df) +
geom_point(
aes(x, y, fill = x),
shape = 21, size = 4, colour = 'red')
以下是ggmap 的示例,其中fill 和colour 均已设置(但未映射到美学):
library("ggmap")
us = c(left = -125, bottom = 25.75, right = -67, top = 49)
map = get_stamenmap(us, zoom = 5, maptype = "toner-lite")
df2 = data_frame(
x = c(-120, -110, -100, -90, -80),
y = c(30, 35, 40, 45, 40))
ggmap(map) +
geom_point(
aes(x, y), data = df2,
shape = 21, fill = 'blue', colour = 'red', size = 4)
但除非您使用这些特殊形状,否则如果您使用点,请给它一个colour,而不是fill(因为大多数点都没有)。