[R] Balloon plot scaling problem
John Kane
jrkrideau at inbox.com
Sun May 25 16:34:23 CEST 2014
@ Jim,
I think you have a corrupted verison of ggplot2 as it has a complete help section--occassionally, wll usually, a bit terse but it's there.
I don't see why Kathy cannot use your solution in ggplot2.
@ Kathy
Try this . Does it approach what you want? If not Jim may be able to suggest a better scaling factor. BTW dput() is a handy way to supply sample data.
###############################################
library(ggplot2)
library(reshape2)
krdata1 <- structure(list(X = c("a_PMd", "b_SMAproper", "c_pre-SMA", "d_M1a",
"e_S1", "f_CMA", "g_PMv", "h_M1p"), a_PMd = c(0.4938019, 0.5076123,
0.513509, 0.4906899, 0.4021556, 0.4212536, 0.4038168, 0.3471316
), b_SMAproper = c(0.5076123, 0.4814135, 0.4728626, 0.4372118,
0.3008708, 0.4024063, 0.4249524, 0.413334), c_pre.SMA = c(0.513509,
0.4728626, 0.4727388, 0.3944285, 0.4695559, 0.3870128, 0.4082124,
NA), d_M1a = c(0.4906899, 0.4372118, 0.3944285, 0.4675951, 0.4450485,
0.3899106, 0.3376981, 0.4298238), e_S1 = c(0.4021556, 0.3008708,
0.4695559, 0.4450485, 0.4158451, 0.3941677, 0.3055601, 0.3726385
), f_CMA = c(0.4212536, 0.4024063, 0.3870128, 0.3899106, 0.3941677,
0.3656597, 0.3655603, 0.4112778), g_PMv = c(0.4038168, 0.4249524,
0.4082124, 0.3376981, 0.3055601, 0.3655603, 0.3471682, 0.303521
), h_M1p = c(0.3471316, 0.413334, NA, 0.4298238, 0.3726385, 0.4112778,
0.303521, 0.3267115)), .Names = c("X", "a_PMd", "b_SMAproper",
"c_pre.SMA", "d_M1a", "e_S1", "f_CMA", "g_PMv", "h_M1p"), class = "data.frame", row.names = c(NA,
-8L))
krdata2<-melt(krdata1,value.name="median")
krdata2$median <- (krdata2$median+0.65)^5
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.6, 2.3),guide="legend",
breaks=waiver(), expand=waiver())
print(balloon)
###############################################
John Kane
Kingston ON Canada
> -----Original Message-----
> From: jim at bitwrit.com.au
> Sent: Sun, 25 May 2014 09:36:10 +1000
> To: dwinsemius at comcast.net
> Subject: Re: [R] Balloon plot scaling problem
>
> On Sat, 24 May 2014 08:56:59 AM David Winsemius wrote:
>> http://stackoverflow.com/questions/20458379/changing-size-of-the-dots-in-a-b
>> alloon-plot-and-keeping-zero-values:
>
> Hi David,
> I checked this out and it appears to be a solution to the problem of zero
> values becoming invisible when a size transformation is applied to the
> ggplot2 object. While this is a nice solution to the problem posed, it
> doesn't seem to address Kathy's difficulty in emphasizing the differences
> between her closely spaced values. I reinstalled ggplot2, but I couldn't
> work out how to reproduce her plot as the help page for "ggplot2" seems
> to be blank. I had a look at the "stat" and "scale" arguments/functions,
> but was unable to locate anything that allowed the user to specify an
> arbitrary transformation of data values to plot areas. Perhaps someone
> with a better knowledge of ggplot2 can provide an answer.
>
> Jim
>
> ______________________________________________
> 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.
____________________________________________________________
Protect your computer files with professional cloud backup.
Get PCRx Backup and upload unlimited files automatically.
Learn more at http://backup.pcrx.com/mail
More information about the R-help
mailing list