File talk:Religious affiliation in New Zealand 1991-2006 - bar chart.svg

Latest comment: 14 years ago by Avenue in topic Source code and data

Source code and data edit

R code (offered under the GPL v2 or later, as well as the usual CC-BY-SA and GFDL licenses):

library(ggplot2)
rel2 <- read.csv("NZ religious affiliation 1991-2006.csv")
svg("Religious affiliation in New Zealand 1991-2006 - bar chart.svg", width=5.6, height=3.5)
p <- ggplot(rel2, aes(x=Year, y=Percentage, group=Religion))
p + geom_bar(aes(colour = Religion, fill = Religion), stat="identity", position="dodge") +
    scale_x_continuous(breaks=c(1991, 1996, 2001, 2006)) + scale_colour_brewer() + scale_fill_brewer()
dev.off()

Data, stored in "NZ religious affiliation 1991-2006.csv":

"Religion","Percentage","Year"
"Christian",70.22794,1991
"No Religion",20.2187572,1991
"Object to Answering",7.5907304,1991
"Other",1.96257,1991
"Christian",64.2951,1996
"No Religion",25.4680196,1996
"Object to Answering",7.5350938,1996
"Other",2.70178,1996
"Christian",60.6,2001
"No Religion",29.636936,2001
"Object to Answering",6.897005,2001
"Other",2.86606,2001
"Christian",55.6,2006
"No Religion",34.6480923,2006
"Object to Answering",6.4805703,2006
"Other",3.27134,2006

Source: Statistics New Zealand. For links see image page.

-- Avenue (talk) 00:44, 16 January 2010 (UTC)Reply

Return to the file "Religious affiliation in New Zealand 1991-2006 - bar chart.svg".