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? -- View this message in context: http://r.789695.n4.nabble.com/GGplot-controlling-point-size-across-range-tp4290858p4290858.html Sent from the R help mailing list archive at Nabble.com.
A) There is a dedicated ggplot mailing list. B) proper protocol here is to provide a reproducible example including sample data that we can run. See the posting guide mentioned at the end of every message. C) create a factor (perhaps using the cut function) in your original data set, before subsetting. Use that factor to set your sizes in all your graphs. D) you might want to try using a factor that indicates which data goes in each plot and use facet wrap on your whole data set to put all the plots together. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. 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? > > >-- >View this message in context: >http://r.789695.n4.nabble.com/GGplot-controlling-point-size-across-range-tp4290858p4290858.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
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/