library(HH)
data(USAge.table) ## from latticeExtra
USA79 <- USAge.table[75:1, 2:1, "1979"]/1000000
PL <- plot.likert(USA79,
main="Population of United States 1979 (ages 0-74)",
xlab="Count in Millions",
ylab="Age",
scales=list(
y=list(
limits=c(0,77),
at=seq(1,76,5),
labels=seq(0,75,5),
tck=.5))
)
PL
as.pyramidLikert(PL)
## This example is based on the example in demo(PoorChildren, package="HH")
data(PoorChildren)
PCWPpalette <- c("#A8C2C0", "#C9E9E6", "#D0E39A", "#A3B37B")
PCcount <- plot.likert(PoorChildren, col=PCWPpalette,
ylab="Percent of
poor households
in area",
xlab="Number of Children",
xlab.top=c("No Working Parents", "One or more Working Parents"),
ylab.right=NULL,
scales=list(x=list(
at=seq(-2,2,1)*1000000,
labels=c("2,000,000", "1,000,000","0","1,000,000","2,000,000"))),
rightAxis=FALSE)
PCcount
print(as.pyramidLikert(PCcount), panel.width=.44)
Run the code above in your browser using DataLab