简体   繁体   English

在R w / ggplot2中操纵geom_point的基线大小

[英]Manipulating baseline size of a geom_point in R w/ ggplot2

I have a data set I'm trying to build a scatter plot from in R. 我有一个数据集,我正在尝试从R中构建散点图。

On the Y axis I've got CTR, on the x-axis I've got CPM and I'm trying to scale the size of each point by the volume of impressions. 在Y轴上,我获得了点击率,在X轴上,我获得了CPM,我正在尝试根据展示次数来缩放每个点的大小。

I'm able to successfully plot this but the baseline size of the points is quite small and I'd like to specify a specific baseline size to use and then scale up from there based off the Volume data. 我能够成功绘制出该图形,但是这些点的基线大小很小,我想指定要使用的特定基线大小,然后根据“体积”数据从此处进行放大。

Here is my current code: 这是我当前的代码:

data_set <- ggplot(mopub_pubs_2, aes(x=CPM, y=CTR))
data_set + geom_point(aes(size=Volume))

I've looked through the ggplot documentation but can't find anything that might allow me to manipulate size of points this way. 我浏览了ggplot文档,但找不到任何可能使我以这种方式操纵点的大小的东西。 Is anyone aware of a way to do this? 有人知道这样做的方法吗?

You can use function scale_size_continuous() to change size of your points. 您可以使用函数scale_size_continuous()更改点的大小。 Default range= for points is form 1 to 6 and your Volume values are scaled in this range but you can change it to some larger values, for example, from 5 to 12. 点的默认range=从1到6,并且您的音量值在此范围内缩放,但是您可以将其更改为更大的值,例如从5到12。

+ scale_size_continuous(range=c(5,12))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM