Bubble Plot - make size of bubble proportional to comm. probability
Hi Suoqin,
I am wondering if it is possible to change the parameters of the netVisual_bubble function such that the SIZE of the bubbles (instead of the colours) on the plot are proportional to the communication probability? (e.g. bigger size bubble = higher communication probability, smaller dot = lower communication probability)?
Thank you!
Evelyn
@EvelynZav It is possible, but you need to modify the codes below
values <- c(1,2,3); names(values) <- c("p > 0.05", "0.01 < p < 0.05","p < 0.01") g <- g + scale_radius(range = c(min(df$pval), max(df$pval)), breaks = sort(unique(df$pval)),labels = names(values)[values %in% sort(unique(df$pval))], name = "p-value") #g <- g + scale_radius(range = c(1,3), breaks = values,labels = names(values), name = "p-value") if (min(df$prob, na.rm = T) != max(df$prob, na.rm = T)) { g <- g + scale_colour_gradientn(colors = colorRampPalette(color.use)(99), na.value = "white", limits=c(quantile(df$prob, 0,na.rm= T), quantile(df$prob, 1,na.rm= T)), breaks = c(quantile(df$prob, 0,na.rm= T), quantile(df$prob, 1,na.rm= T)), labels = c("min","max")) + guides(color = guide_colourbar(barwidth = 0.5, title = "Commun. Prob.")) } else { g <- g + scale_colour_gradientn(colors = colorRampPalette(color.use)(99), na.value = "white") + guides(color = guide_colourbar(barwidth = 0.5, title = "Commun. Prob.")) }