更改气泡图中使用的尺寸范围

Alp*_*GPC 7 charts r ggplot2

我正在使用R来创建我正在研究的行业中的战略群体的竞争地图.出口数量沿x轴,销售额是y轴以及泡沫的大小.使用的代码:

qplot(data = supermarket, x = outlets, y = sales, size = sales, color = retailer)   
Run Code Online (Sandbox Code Playgroud)

但是,我需要增加气泡的整体尺寸,因为目前还不清楚.请参阅下面的示例.

图形

我需要的是让气泡保持其相对于销售的规模,但总体上变得更大,以提高可见度.

Tyl*_*ker 8

玩:+ scale_size_continuous(range = c())如:

#set.seed(10)
#supermarket <- data.frame(sales = sample(1:50000, 12), 
#    outlets = sample(1:3000, 12), retailer = LETTERS[1:12])

#I use ggplot rather than qplot and understand it so that's what I used here
ggplot(data = supermarket, aes(x=outlets, y=sales, size=sales, color=retailer)) + 
            geom_point() + scale_size_continuous(range = c(3, 8))
Run Code Online (Sandbox Code Playgroud)

或者您可以使用您的代码并添加scale_size_continuous上面的bdemarest建议:

qplot(data = supermarket, x = outlets, y = sales, size = sales, color = retailer) + 
    scale_size_continuous(range = c(3, 8))
Run Code Online (Sandbox Code Playgroud)

两者都会产生相同的结果.