0

这种创建人口金字塔的方法曾经对我有用,现在不知何故冻结了我的 RStudio,所以我每次都需要重新启动它,我没有进步......

如果有人能让我知道是什么让 R 停止,将不胜感激......

   Males <- c(26069148,1698171,1521271,1577011,1706618,1810404,1820536,1754903,1765582,1923441,1919758,1687729,1481745,1557140,1217965,967953,755703,519650,275459,108109)
Females <- c(26943308,1620278,1451361,1503918,1633647,1784917,1830345,1754318,1783534,1962493,1960057,1712366,1515247,1615137,1290189,1076176,913642,739123,500852,295708)

Males
Females


AgeGroup= c("All Ages", "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-84", "85-89", "90 and older")

library(plotrix)

xy.people <- Males
xx.people <- Females

mcol<-color.gradient(c(0,0,0.5,1),c(0,0,0.5,1),c(1,1,0.5,1),18)
fcol<-color.gradient(c(1,1,0.5,1),c(0.5,0.5,0.5,1),c(0.5,0.5,0.5,1),18)
par(mar=pyramid.plot(xy.people,xx.people,labels=AgeGroup,top.labels=c("Male","Age Group","Female"),
                 main="England",lxcol=mcol,rxcol=fcol,
                 gap=0, labelcex = 0.5, unit="No. of People"))

如果我将以下内容添加到代码中,它会起作用:laxlab=seq(0,1e7,by=1e6),raxlab=seq(0,1e7,by=1e6)) 如这篇文章中所述: R pyramid plot very slow if fed更大的数字

4

0 回答 0