ropensci/plotly — pull request #108 by pedrodz (2014-09-26 14:06:50+00:00)
Title: ggplot: geom_point: size

When using size, ggplot changes circle sizes relatively using a range of 1-6. https://github.com/hadley/ggplot2/blob/4bb9270ef4d5d5062353438fd99d17b6f6de98a2/R/scale-size.r

The mathematical conversion was based on this post: http://stackoverflow.com/questions/929103/convert-a-number-range-to-another-range-maintaining-ratio

The minimum range in ggplot (1) is equivalent to the width of a grid line. For plotly, this is 0.25. As to keep the original difference (6 - 1 = 5), we use (5.25 - 0.25 = 5)

This translation is not perfect, because in addition ggplot sizes the markers line width in terms of size of circles - Plotly only uses one value for all makers lines width. https://github.com/hadley/ggplot2/blob/4bb9270ef4d5d5062353438fd99d17b6f6de98a2/R/scale-size.r#L53-L55

Examples using these changes:
map: https://plot.ly/~pdespouy/1325/lat-vs-long/
sepal&petal: https://plot.ly/~pdespouy/1324/sepalwidth-vs-petalwidth/
mpg&wt: https://plot.ly/~pdespouy/1329/mpg-vs-wt/