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. Eg. A small point may represent 2 and a big point may represent 10. The problem is that my data range between 0.3 and 0.52, which is a very small difference between the smallest and largest values. I would like 0.3 to be represented by the smallest balloon (point) and 0.52 to be represented by the largest balloon (point). The code allows you to enter 'limits' which I set from 0.3 to 0.52 but regardless of this it seems to scale the balloons assuming that the scale starts at 0, rather than at 0.3. As a result, the difference in size between my different values is barely noticeable- all the balloons are close to the largest size. The matrix of data is too large for me to add here, but imagine a square matrix with headers along the top and sizes like this:
X a_PMd b_SMAproper c_pre.SMA d_M1a e_S1 f_CMA g_PMv h_M1p 1 a_PMd 0.4938019 0.5076123 0.5135090 0.4906899 0.4021556 0.4212536 0.4038168 0.3471316 2 b_SMAproper 0.5076123 0.4814135 0.4728626 0.4372118 0.3008708 0.4024063 0.4249524 0.4133340 3 c_pre-SMA 0.5135090 0.4728626 0.4727388 0.3944285 0.4695559 0.3870128 0.4082124 NA 4 d_M1a 0.4906899 0.4372118 0.3944285 0.4675951 0.4450485 0.3899106 0.3376981 0.4298238 5 e_S1 0.4021556 0.3008708 0.4695559 0.4450485 0.4158451 0.3941677 0.3055601 0.3726385 6 f_CMA 0.4212536 0.4024063 0.3870128 0.3899106 0.3941677 0.3656597 0.3655603 0.4112778 7 g_PMv 0.4038168 0.4249524 0.4082124 0.3376981 0.3055601 0.3655603 0.3471682 0.3035210 8 h_M1p 0.3471316 0.4133340 NA 0.4298238 0.3726385 0.4112778 0.3035210 0.3267115 I then use Melt to put it into the format that the plot requires: krdata2<-melt(krdata1,value.name="median") balloon=ggplot(krdata2,aes(x=X,y=variable))+ geom_point(aes(size=median),shape=21,color="black",fill="lightblue")+ scale_size_area(max_size=40,limits=c(0.3, 0.52),guide="legend", breaks=waiver(), expand=waiver()) print(balloon) As you can see, I have set the limited to 0.3- 0.52, but still it assumes that the scale starts at 0 and the smallest balloon would be around a value of 0.1. Anybody got any ideas for how to change this scaling?? I would be very grateful!! Thank you in advance Kathy ______________________________________________ R-help@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.