In [34]:
%matplotlib inline
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
from pylab import rcParams
rcParams['figure.figsize'] = 8, 8
names = ['LinearRegression', 'RandomForest', 'DecisionTree', 'GradientBoosting']
time = [[0.054, 0.066, 0.054, 0.509], [0.006, 0.016, 0.009, 0.021]]
score = [[0.85, 0.962, 0.966, 0.977], [0.83, 0.997, 0.995, 0.997]]
sparkmach = pd.DataFrame({'name': names, 'time': time[0], 'score': score[0] })
pymach = pd.DataFrame({'name': names, 'time': time[1], 'score': score[1] })
# sparkmach_2 = pd.DataFrame({'name': names, 'time': time[0], 'score': score[0] })
# pymach_2 = pd.DataFrame({'name': names, 'time': time[1], 'score': score[1] })
# initialise the figure. here we share X and Y axis
fig, axes = plt.subplots(nrows=2, ncols=1, sharex=True)
axes[0].plot( 'name', 'time', data=sparkmach, marker='o', alpha=0.9, label='Sparkmach')
axes[0].plot( 'name', 'time', data=pymach, marker='o', alpha=0.9, label='Pymach')
axes[1].plot( 'name', 'score', data=sparkmach, marker='o', alpha=0.9)
axes[1].plot( 'name', 'score', data=pymach, marker='o', alpha=0.9)
# axes[1].plot( 'name','time', data=df, marker='o', color="orange", alpha=0.3)
# axes[1].plot( 'name','time', data=df, marker='o', color="orange", alpha=0.3)
axes[0].set_ylabel('Time (min)')
axes[1].set_ylabel('Score')
# axes[0].set_xlabel('Time (min)')
# axes[0].title.set_text('These 2 plots have the same limit for the Y axis')
axes[0].legend(loc='upper left')
# plt.subplots(figsize=(15,15))
plt.savefig('pymach_sparkmach_tupac.eps', format='eps', dpi=1200)
plt.show()
In [17]:
ax0 = axes[0]
ax0.set_ylabel('Time (min)')
Out[17]:
In [ ]:
ax0.legend()