更改气泡图中使用的大小范围 [英] Changing the range of sizes used in a bubble plot

查看:365
本文介绍了更改气泡图中使用的大小范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R创建我正在研究的行业中战略集团的竞争地图。出口数沿x轴,销售数为y轴以及气泡的大小。使用的代码:

I'm using R to create a competitive map of strategic groups in the industry I'm researching. The number of outlets is along the x-axis, Sales is the y-axis as well as the size of the bubble. Code used:

qplot(data = supermarket, x = outlets, y = sales, size = sales, color = retailer)   

但是,由于目前尚不清楚,我需要增加气泡的整体大小。

However, I need to increase the overall size of the bubbles as it is too unclear at the moment. Please see below for an example.

我需要的是使气泡相对于销售保持其大小,但总体上变大以增加可见度。

What I need is to have the bubbles keep their size relative to sales but become larger overall to increase the visibility.

推荐答案

播放方式: + 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))

或者您也可以使用代码并按照bdemarest的建议添加 scale_size_continuous : / p>

Or you can just use your code and add the scale_size_continuous as bdemarest suggests above:

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

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

Both will yield the same results.

这篇关于更改气泡图中使用的大小范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆