# NOT RUN {
data(dhb_cars)
tris<-tri_alloc(dhb_cars[,-1], c("green","gold","orange","goldenrod"), names=dhb_cars$dhb )
dhtri(tri_colours=tris,
legend=list(fill=c("green","gold","orange","goldenrod"),
border=NA,
legend=c("0","1","2","3+"),
title="Cars/Household")
)
households<-rowSums(dhb_cars[,-1])
names(households)<-dhb_cars$dhb
dhbin(radius=sqrt(households))
title(main="Number of households in private dwellings")
opar<-par(mfrow=c(2,3),mar=c(1,1,1,1))
z<-rnorm(20)
for(i in 1:6){
z<-(rnorm(20)+z)/sqrt(2)
z1<- (z+4)/8
col_z<-rgb(colorRamp(c("blue", "white","red"))(z1),max=255)
dhbin(hex_colours=col_z,border="grey",short=TRUE,
legend_opts=list(fill=c("red","white","blue"),
legend=c("High","Medium","Low"),
title=paste("Thing",i))
)
}
par(opar)
data(region_ethnicity)
cols<-tri_alloc(as.matrix(region_ethnicity[,-1]),
colours=hcl.colors(5,"Set2"),names=region_ethnicity$Area)
regiontri(tri_colours=cols,text_colour="white",
legend_opts=list(fill=hcl.colors(5,"Set2"),
title="Ethnicity",
legend=names(region_ethnicity)[2:6]))
title(main="New Zealand regions")
# }
Run the code above in your browser using DataLab