In [1]:
import numpy as np
import matplotlib.pyplot as plt

In [2]:
%pylab notebook
%matplotlib notebook


Populating the interactive namespace from numpy and matplotlib

In [3]:
rain = (20, 35, 30, 35, 27, 12, 21, 16, 16, 20, 11, 12)

temp = (25, 32, 34, 20, 25, 14, 13, 14, 15, 16, 17, 18)

i = np.arange(len(rain))
fig, rr = plt.subplots()

#bar_width = 1

opacity = 0.4
#error_config = {'ecolor': '0.3'}


rr.bar(i, rain, alpha=opacity, color='b',
                 label='rain', align='center')

tt=plt.twinx()
tt.plot(temp, linestyle='-', linewidth=1.0, label='temp')

plt.xlabel('months')
rr.set_ylabel('(mm)')
#plt.ylabel('(mm)')
tt.set_ylabel('(C)')
plt.title('rain and temp')
plt.xticks(i,('jan', 'feb', 'mar', 'apr', 'mai', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dez'))
plt.legend()
plt.grid(True)


rr.set_ylim([0,40])
plt.tight_layout()
plt.show()



In [ ]: