0

I am plotting points on a graph with ggplot and geom_point. The size of the dots corresponds to the magnitude of the data point. The magnitude goes from 2 to 10. I would like to draw the dots by applying a factor of 0.5 to their magnitude so that the sizes go from 1 to 5. In the legend, on the side of the graph, I would like to show the real magnitude from 2 to 10.

How can I do that?

patzoul
  • 49
  • 2
  • 6
  • possible duplicate of [How to add a condition to the geom\_point size?](http://stackoverflow.com/questions/2361557/how-to-add-a-condition-to-the-geom-point-size) – hrbrmstr Apr 20 '14 at 12:01
  • More of "I think you'll see the answer in there" vs a full dup. – hrbrmstr Apr 20 '14 at 12:01

1 Answers1

0

There are two possibilities:

1) Divide the magnitude by 2:

geom_point(aes(size = magnitude/2))

2) Use the range = c(1,5) parameter:

geom_point(aes(size = magnitude)) +
scale_size(range = c(1,5))
Jaap
  • 81,064
  • 34
  • 182
  • 193