How can I add one legend for all subplots? The legend should be on the side with 4 markers one below the other:
- c='738A3E', alpha=0.3, marker='^'
- c='#738A3E', alpha=0.3, marker='v'
- c='#007CAE', alpha=0.3, marker='^'
- c='#007CAE', alpha=0.3, marker='v'
I cannot figure out how to even generate a legend for this. Help would be much appreciated.
fig1 = plt.figure(figsize=(6, 12))
for i in range(0,10):
plt.subplot(5, 2, i+1).set_title('Range {}' .format(i+1))
plt.tight_layout()
for j in range(0, X.shape[1]):
if X[12,j] > 75 and X[10,j] > 7000:
ax1 = plt.scatter(X[i,j], y[i,j], c='#738A3E', alpha=0.3, marker='^')
elif X[12,j] > 75 and X[10,j] <= 7000:
ax2 = plt.scatter(X[i,j], y[i,j], c='#738A3E', alpha=0.3, marker='v')
elif X[12,j] <= 75 and X[10,j] > 7000:
ax3 = plt.scatter(X[i,j], y[i,j], c='#007CAE', alpha=0.3, marker='^')
elif X[12,j] <= 75 and X[10,j] <= 7000:
ax4 = plt.scatter(X[i,j], y[i,j], c='#007CAE', alpha=0.3, marker='v')
plt.xlim([min(X[i,:]), max(X[i,:])])