Cad*_*ama 17 bubble-chart r crosstab
我看到了excel生成的情节,我想知道R是否也可以做到.
这张图片基本上是交叉表的可视化,比较了当天的天数与当天的首选膳食以及计算属于这些类别的人数.
我已经阅读了一些R气泡图,但我还没有看到这样的一个.有人能指出我的包裹或网站,解释我如何制作这样的情节?
Tom*_*ell 20
使用Hadley Wickham的ggplot2:
library(ggplot2)
# Set up the vectors
days <- c("Mon","Tues","Wed","Thurs","Fri")
slots <- c("Coffee/Breakfast","Lunch","Happy Hour","Dinner")
# Create the data frame
df <- expand.grid(days, slots)
df$value <- c(1,1,1,1,2,1,1,NA,NA,1,4,4,7,4,1,5,6,14,5,1)
#Plot the Data
g <- ggplot(df, aes(Var1, Var2)) + geom_point(aes(size = value), colour = "green") + theme_bw() + xlab("") + ylab("")
g + scale_size_continuous(range=c(10,30)) + geom_text(aes(label = value))
Run Code Online (Sandbox Code Playgroud)

你是否关心轴线穿过圆圈?此外,果岭略有不同,标签文字是黑色而不是白色.