我想做一个散点图,它的点没有填充(或者等效地,用透明填充)。
# generate some random data for the scatterplot
n <- 5
f <- factor(1:n)
df <- expand.grid(f1 = f, f2 = f)
df <- transform(df, v1 = round(10 * runif(n ** 2)))
# plot the scatterplot
ggplot(df) + geom_point(aes(x = f1, y = f2, size = v1, fill = NA))
设置fill
为NA
似乎合乎逻辑,但不工作。我还尝试了NULL
和""
,但无济于事。
我认为你想玩形状,但可能是错误的:
ggplot(df) + geom_point(aes(x = f1, y = f2, size = v1), shape=1)
或者……
ggplot(df) + geom_point(aes(x = f1, y = f2, size = v1), fill="green", shape=21)
在ggplot (ggplot2_3.0.0)的后续版本中,您可以使用任何形状执行以下操作:
ggplot(df) +
geom_point(aes(x = f1, y = f2, size = v1, shape = v1)) +
scale_shape(solid = FALSE)