R语言绘制金字塔图
首先我们要知道金字塔图典型的是人口金字塔图,人口金字塔是用类似古埃及金字塔的形象描绘人口年龄和性别分布状况的图形,能表明人口现状及其发展类型。当有类似的信息需要表达时,即可用金字塔图来呈现。以下有两种绘图方法,可供参考哦~
PART01
1.导入plotrix包
library(plotrix)
2.构建示例数据
m.pop <- runif(18,0,4)
f.pop <- runif(18,0,4)
3.分组
agelabels<-c("0-4","5-9","10-14","15-19","20-24","25-29","30-34",
"35-39","40-44","45-49","50-54","55-59","60-64",
"65-69","70-74","75-79","80-44","85+")
4.颜色区分
mcol <- color.gradient(c(1,0,0.4,2),c(0,1,0.4,2),c(1,1,0.4,1),18)
fc