[R] Balloon plot scaling problem

Jim Lemon jim at bitwrit.com.au
Sat May 24 05:05:09 CEST 2014


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, 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



More information about the R-help mailing list