Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the range of sizes used in a bubble plot

Tags:

r

ggplot2

charts

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.

Graph

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

like image 212
AlphaGPC Avatar asked Jul 19 '12 23:07

AlphaGPC


People also ask

How do you change the size of a bubble chart in Excel?

For our bubble chart, we used Style 29. On the chart, click the legend, and then press DELETE. To change the size of the chart, on the Format tab, in the Size group, select the shape size that you want in the Shape Height and Shape Width box, and then press ENTER.

How do you increase bubble size in Think cells?

Note that you can change the bubble size by selecting any bubble and dragging its handle.

What does the size of the bubble in a bubble chart represent?

Each bubble's size indicates the number of wins earned by each team, with larger bubbles corresponding to higher win rates.

How do I change the data labels in a bubble chart?

Click the chart, and then click the Chart Design tab. Click Add Chart Element and select Data Labels, and then select a location for the data label option. Note: The options will differ depending on your chart type. If you want to show your data label inside a text bubble shape, click Data Callout.


1 Answers

Play with: + scale_size_continuous(range = c()) as in:

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

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.

like image 169
Tyler Rinker Avatar answered Sep 22 '22 19:09

Tyler Rinker