Я хотел бы создать график плотности пирамиды следующим образом:
То, что я могу достичь, - это просто график пирамиды, основанный на следующем примере примера:
set.seed (123)
xvar <- round (rnorm (100, 54, 10), 0)
xyvar <- round (rnorm (100, 54, 10), 0)
myd <- data.frame (xvar, xyvar)
valut <- as.numeric (cut(c(myd$xvar,myd$xyvar), 12))
myd$xwt <- valut[1:100]
myd$xywt <- valut[101:200]
xy.pop <- data.frame (table (myd$xywt))
xx.pop <- data.frame (table (myd$xwt))
library(plotrix)
par(mar=pyramid.plot(xy.pop$Freq,xx.pop$Freq,
main="Population Pyramid",lxcol="blue",rxcol= "pink",
gap=0,show.values=F))
Как я могу это достичь?