[R] GGplot controlling point size across range

Hadley Wickham hadley at rice.edu
Fri Feb 10 13:48:07 CET 2012


On Thu, Jan 12, 2012 at 5:27 PM, Darran King <darran.king at csiro.au> wrote:
> Hi all
>
> New to R and GGplot2 but loving the potential. I am trying to plot four
> separate point plots by looping over the data and plotting a different
> subset each time.
>
> When I plot the data as a point plot, the size of the points is determined
> by the data values used as below
>
> qplot(accum_rain, accum_g_radn, data = clim_sub[[i]], size = avgyld, colour
> = avgyld)
>
> The problem is that i want all four plots to be comparable, so a point size
> representing avgyld = 2000 should be the same on all four plots. However as
> the data for some plots has a smaller range than others and the plots are
> automatically scalling to the range of data in each plot, and the largest
> point is always assigned to the largest value a plot with a top value of say
> 5000 with be represented with the same size point as a plot with a top value
> of 7000.
>
> Any tips on how to scale the point sizes to a defined range of classes and
> still plot the actual data to those classes?

Specify limits to scale_area:  + scale_area(limits = c(0, 1000))

If you're still having problems, you might want to try the ggplot2
mailing list, as Jeff suggested.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list