# coding: utf-8
#!/usr/bin/env python
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import numpy as np
data = np.array([
[1975, 39828, 1011],
[1976, 39656, 1066],
[1977, 39418, 1196],
[1978, 40961, 1533],
[1979, 42095, 1847],
[1980, 42225, 1903],
[1981, 42647, 2153],
[1982, 43371, 2247],
[1983, 43926, 3330],
[1984, 44452, 3421],
[1985, 45092, 3759],
[1986, 46431, 4159],
[1987, 47186, 7393],
[1988, 46525, 8244],
[1989, 45594, 10986],
[1990, 55452, 13820],
[1991, 57221, 14179],
[1992, 59916, 14340],
[1993, 56905, 16271],
[1994, 54384, 19066],
[1995, 51957, 22162],
[1996, 49670, 24686],
[1997, 49086, 27055],
[1998, 48742, 26564],
[1999, 51273, 41959],
[2000, 50601, 47710],
[2001, 41191, 45333],
[2002, 33807, 43635],
[2003, 29857, 37825],
[2004, 27093, 38324],
[2005, 26336, 37091],
[2006, 26401, 42448],
[2007, 27779, 50512],
[2008, 27942, 52514],
[2009, 27321, 49732],
[2010, 49265, 52797],
[2011, 47323, 53673],
[2012, 46308, 51911],
[2013, 46377, 51877],
[2014, 45392, 52746]])
# Prepare axis
fig = plt.figure(figsize=(8, 3))
ax = fig.add_subplot(111)
# Plot data
year = data[:, 0]
national = data[:, 1] / 1000
foreign = data[:, 2] / 1000
ax.stackplot(year, national, foreign)
# Cosmetics
plt.xlim(min(year), max(year))
ax.minorticks_on()
fig.subplots_adjust(bottom=0.15)
plt.grid()
plt.title(u'Mitarbeiterentwicklung im Deutsche Bank Konzern 1975-2014')
plt.xlabel('Jahr')
plt.ylabel('Mitarbeiter in Tausend')
p1 = Rectangle((0, 0), 1, 1, fc="blue")
p2 = Rectangle((0, 0), 1, 1, fc="green")
plt.legend([p1, p2], ['Inland', 'Ausland'], loc=2)
# Save figure
plt.savefig('deutschebank.svg', transparent=True)