10

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.

Brian Diggs
  • 57,757
  • 13
  • 166
  • 188
AlphaGPC
  • 101
  • 1
  • 1
  • 3

1 Answers1

11

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.

Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
  • Amazing. Thanks so much, this almost perfect. However, if i want to change LETTERS into the column names (the names of the supermarkets) which command should i use? – AlphaGPC Jul 20 '12 at 12:07
  • Use your data. They're only letters because I made up data. – Tyler Rinker Jul 20 '12 at 13:18
  • Thanks. But which 'code' (object?) should i use instead of LETTERS ? – AlphaGPC Jul 20 '12 at 16:10
  • By looking at your code you have 3 columns: `sales`, `outlets`, & `retailer`. Use those. In fact you can ignore the first part of my code as you already have this in a dataframe (I'll gray it out) I just provided the sample dataframe (as you should do when you ask a question) to make the outcome reproducible for future searchers with a similar question. – Tyler Rinker Jul 20 '12 at 17:28