我有一个散点图。我想按频率缩放每个点的大小。所以我有一个相同长度的频率列。但是,如果我这样做:
... + geom_point(size=Freq)
我收到这个错误:
When _setting_ aesthetics, they may only take one value. Problems: size
我将其解释为所有点只能有 1 个大小。那么我该如何做我想做的事呢?
更新:数据是here 我使用的基本代码是:
dcount=read.csv(file="New_data.csv",header=T)
ggplot(dcount,aes(x=Time,y=Counts)) + geom_point(aes(size=Freq))
最佳答案
你试过吗..
+ geom_point(aes(size = Freq))
美学通过 aes
函数映射
到数据中的变量。查看http://had.co.nz/ggplot2/geom_point.html
关于r - 为什么 ggplot2 不允许我为每个单独的点设置大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3190087/