[R] Balloon plot scaling problem

David Winsemius dwinsemius at comcast.net
Sat May 24 17:56:59 CEST 2014


On May 23, 2014, at 8:05 PM, Jim Lemon wrote:

> On Fri, 23 May 2014 12:19:11 PM Ruddy Kathy wrote:
>> Hi Guys,
>> 
>> I have been trying to create a 'balloon plot' using R, which is where the
>> points in a plot are scaled such that the size of the point (area)
>> represents the value. 
>> ...
>> Anybody got any ideas for how to change this scaling??
>> I would be very grateful!!
>> 
> Hi Kathy,


> This isn't ggplot,

Searching SO with: [r] ggplot balloon ... gives:

http://stackoverflow.com/questions/20458379/changing-size-of-the-dots-in-a-balloon-plot-and-keeping-zero-values:


> but you can apply whatever scaling function you want in 
> size_n_color (plotrix). I read in your example as a data frame named 
> "krdata2". Perhaps it will be useful.
> 
> krmed<-sapply(krdata2[,2:9],median,na.rm=TRUE)
> x11(width=8,height=3)
> stretch_it<-function(x) (x+0.65)^5
> library(plotrix)
> size_n_color(seq(1,32,length.out=8),rep(1,8),krmed,
> sizefun="stretch_it", xlim=c(0,32),col=rep(3,8),
> xat=seq(1,32,length.out=8),yat=c(0.5,1.5),
> main="size_n_color",xlab="",ylab="",
> xaxlab=names(krmed),mar=c(5,4,4,5))
> 
> Jim
> 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list