r - ggplot散点图,无填充

标签 r ggplot2

我想制作一个散点图,其点没有填充(或等效地,有透明填充)。

# 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)


如果要填充颜色。

关于r - ggplot散点图,无填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15726907/

相关文章:

r - unique() 是否保留顺序?

r - ggplot2世界地图中的图例大小

c - 使用降雪包在 R 中使用 C-within-R 函数进行并行计算。问题 : Mac shows loading wheels and almost freezes

r - 替换函数工厂 r 中的形式参数

r - 使用ggplot从热图中的透明度中排除单元格

删除使用plotmath制作的ggrepel标签之间的空间

r - 将x或y轴与刻度标签一起移动到单个ggplot的中间(无构面)

删除绘制数据和轴之间的空间

r - 错误: number of rows of matrices must match (ggplot facet)

r - 将线段添加到现有的小平面网格ggplot r