# NOT RUN {
data(immune)
summary(immune)
immune$vax_pct<-cut(immune$Pcttotal,c(0,.80,.85,.90,.95,1))
ggplot(immune)+
geom_dhb(aes(fill=vax_pct,map_id=dhb_fixname(DHB)))+
scale_fill_viridis_d(drop=FALSE)+
geom_label_dhb(short=TRUE,colour="white")
## size variation, plus stacking to show the full-size hexes underneath,
## plus no labels
ggplot(immune)+
geom_dhb(aes(map_id=dhb_fixname(DHB)),fill="white",colour="grey",coord=FALSE)+
geom_dhb(aes(fill=vax_pct,map_id=dhb_fixname(DHB),radius=sqrt(Ntotal)),alpha=0.5)+
scale_fill_viridis_d(drop=FALSE)
data(immune_long)
ggplot(immune_long) +
geom_dhb(aes(map_id=dhb_fixname(DHB),fill=pct_vax),
alpha=0.5,colour="lightgrey") +
scale_fill_viridis_d(drop=FALSE)+
geom_label_dhb(short=TRUE,colour="black",cex=3)+
facet_wrap(~ethnicity)
data(dhb_cars)
tris<-tri_alloc(dhb_cars[,-1], c("0","1","2","3+"), names=dhb_cars$dhb )
tri_data<-data.frame(DHB=rep(rownames(tris),6),
cars=as.vector(tris),
tri_id=rep(1:6,each=nrow(tris)))
ggplot(tri_data)+
geom_dhbtri(aes(map_id=DHB,class_id=tri_id, fill=cars),alpha=0.5)+
scale_fill_viridis_d()+
geom_label_dhb(short=TRUE)
data(region_ethnicity)
tri_eth<-tri_alloc(as.matrix(region_ethnicity[,-1]),
classes=c("Asian","Euro","Maori","MELAA","Pacific"),
names=region_ethnicity$Area)
tri_data<-data.frame(Region=rep(rownames(tri_eth),6),
ethnicity=as.vector(tri_eth),
tri_id=rep(1:6,each=nrow(tri_eth)))
ggplot(tri_data)+
geom_regiontri(aes(map_id=Region,class_id=tri_id, fill=ethnicity))+
geom_label_region(colour="Black", short=TRUE,cex=3)
# }
Run the code above in your browser using DataLab