In [54]:
import numpy as np
import pandas as pd
import csv
import matplotlib as mpl
mpl.rcParams.update({'font.size': 11, 'font.family':'serif'})
from matplotlib.patches import Rectangle
import matplotlib.pyplot as plt
#import seaborn as sns
#sns.set(style="whitegrid", color_codes=True)
In [55]:
df = pd.read_csv('test_2.csv')
#print df['shock'][0]=='-10%'
#sns.pointplot(x="current_step", y="system_TAS", hue="shock", data=df,
# palette={"-10%": "g", "-20%": "m", "-30%": "c"},
# markers=["^", "o", "x"], linestyles=["-", "--", "---"]);
keys = np.unique(df['shock'])
fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(15,6))
for key in keys:
I = np.argwhere(df['shock']==key).squeeze()
#print df['current_step'][I]
# nrows=2, ncols=2,
# ax[0,0] top left
# ax[0,1] top right
# ax[row, col]
#plt.figure('fig 1')
ax[0].plot(df['current_step'][I], df['system_TAS'][I], label="system_TAS %s"%key)
ax[1].plot()
ax[0].set_xlim(0, 7)
ax[0].set_xlabel("period", fontsize=12)
ax[0].set_ylim(-1e12, 0.2e12)
ax[0].set_ylabel(r"Asset $\delta$ sales", fontsize=12)
ax[0].set_title("My title is", fontsize=15)
handles, labels = ax[0].get_legend_handles_labels()
p1 = Rectangle((0,0), 1, 1, fc="w")
handles.append(p1)
labels.append(r'x')
ax[0].legend(handles, labels)
plt.show()
In [47]:
In [53]: