原始碼 InfoField |
Python code
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Time series of responses to British Social Attitudes question "Do you regard
yourself as belonging to any particular religion? IF YES: Which? IF 'Christian'
PROBE FOR DENOMINATION." Results for all non-Christian religions have been
combined.
Source:
http://www.britsocat.com/BodySecure.aspx?control=BritsocatMarginals&var=RELIGION
&SurveyID=221
"""
from pylab import *
rc('font', family='sans-serif')
rc('figure', figsize=(12,8))
t = [1983,1984,1985,1986,1987,1989,1990,1991,1993,1994,1995,1996,1997,1998,
1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009]
seriesChristian = [66.31,63.97,61.08,61.11,61.57,63.68,60.22,60.92,59.42,57.8,
56.05,52.8,52.05,50.54,51.77,55.18,54.18,53.99,50.14,52.79,53.55,48.05,
48.16,50.16,43.7]
seriesOther = [1.99,3.41,4.32,4.93,4.08,1.7,2.93,3.13,3.48,3.48,3.39,3.79,
4.39,2.98,3.23,4.66,4.00,4.17,5.99,3.33,6.19,5.60,5.70,5.70,5.00]
seriesNone = [31.28,32.2,34.29,33.95,34.32,34.41,36.34,35.08,36.68,38.49,40.38,
42.66,43.02,45.06,43.75,39.5,41.22,41.11,43.04,43.4,39.63,45.77,45.67,
43.64,50.7]
seriesNA = [0.35,0.45,0.31,0.03,0.09,0.17,0.5,0.78,0.43,0.2,0.18,0.79,0.52,
1.36,1.2,0.59,0.66,0.72,0.82,0.49,0.6,0.64,0.57,0.5,0.5]
# red-green colourblind friendly
plot(t, seriesChristian, 's-', lw=3, color='#7570b3')
plot(t, seriesOther, 's-', lw=3, color='#d95f02')
plot(t, seriesNone, 's-', lw=3, color='#1b9377')
ylabel('%')
axis([1982,2009,0,70])
xticks(arange(1983,2009,2))
legend(('Christian', 'Other non-Christian', 'No religion'),'upper right')
grid(True)
savefig('bsa-religion-question.svg')
Data
"Year",1983,1984,1985,1986,1987,1989,1990,1991,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009
"Christian",66.31,63.97,61.08,61.11,61.57,63.68,60.22,60.92,59.42,57.8,56.05,52.8,52.05,50.54,51.77,55.18,54.18,53.99,50.14,52.79,53.55,48.05,48.16,50.16,43.70
"Other non-Christian",1.99,3.41,4.32,4.93,4.08,1.7,2.93,3.13,3.48,3.48,3.39,3.79,4.39,2.98,3.23,4.66,4.00,4.17,5.99,3.33,6.19,5.60,5.70,5.70,5.00
"No religion",31.28,32.2,34.29,33.95,34.32,34.41,36.34,35.08,36.68,38.49,40.38,42.66,43.02,45.06,43.75,39.5,41.22,41.11,43.04,43.4,39.63,45.77,45.67,43.64,50.70
"Ref/NA",0.35,0.45,0.31,0.03,0.09,0.17,0.5,0.78,0.43,0.2,0.18,0.79,0.52,1.36,1.2,0.59,0.66,0.72,0.82,0.49,0.6,0.64,0.57,0.5,0.50
|