欢迎关注天善智能,我们是专注于商业智能BI,人工智能AI,大数据分析与挖掘领域的垂直社区,学习,问答、求职一站式搞定!
对商业智能BI、大数据分析挖掘、机器学习,python,R等数据领域感兴趣的同学加微信:tstoutiao,邀请你进入数据爱好者交流群,数据爱好者们都在这儿。
作者:厚缊,中观经济咨询助理研究员,业余数据科学爱好者。博客:houyun.xyz
上篇:
诹图系列(1): 简单条形图
,这一篇文章主要解决如何用基础绘图系统绘制长标签条形图,再拓展到按照其他因子分类的叠加条形图。
长标签条形图
按照惯例,先上效果图。
数据及标签
原书作者没有提供ZA4753的原始数据,只能根据原图来手动整理。
## 条形的长度
bar_data <- c(70.1, 84.7, 84.8, 35, 33.1, 47.2, 76.4)
## 条形标签,不能放在一行的需要用“\n”手动换行
myC_v159 <- "A working mother can establish just as warm and\nsecure environment as a non-working mother"
myC_v160 <- "A pre-school child is likely to suffer if\nhis or her mother is working"
myC_v161 <- "A job is alright but what most women\nreally want is a home and children"
myC_v162 <- "Being a housewife is just as fulfilling as\nworking"
myC_v163 <- "Having a job is the best way for a woman\nto be independent"
myC_v164 <- "Both the husband and wife should contribute\nto the family income"
myC_v165 <- "In general, fathers are as well suited to\nlook after their children as women"
myC_v166 <- "Men should take as much responsibility\nas women for their household and children"
names <- c(myC_v165, myC_v164, myC_v163, myC_v162, myC_v161, myC_v160, myC_v159)
图形设备
与前面的例子相同,