第1关:柱状图 - 商品房销售价格统计图
import matplotlib
matplotlib.use("Agg")
import numpy as np
import matplotlib.pyplot as plt
sale_price='12914 11826 12997 12306.41 \
12327.28 11406 10608 8378 8667.02\
8052.78 6922.52 5744 4196 4336 4588 4751'
year='2015 2014 2013 2012 2011 \
2010 2009 2008 2007 2006 \
2005 2004 2003 2002 2001 2000'
y=sale_price.split()
y.reverse()
y=[float(e) for e in y]
x=year.split()
x.reverse()
x=[int(e) for e in x]
x_labels=[]
for i in range(2000,2016):
x_labels.append(i)
plt.xticks(x,x_labels,rotation=45)
'''
plt.yticks(range(4000,13500,1000))
plt.ylim(4000,13500)
'''
y_labels=[]
for j in range(4000,13500,1000):
y_labels.append(j)
plt.yticks(y_labels)
plt.ylim(4000,13500)
plt.bar(x, y, color='#800080')
plt.savefig("picture/step1/fig1.png")

第2关:并列柱状图 - 商品房销售价格统计图