PR3-Klausur-Uben/PYTHON/matplot.py

29 lines
589 B
Python

import matplotlib.pyplot as plt
year = [1800, 1850, 1900, 1950, 1970, 1990, 2010, 2100]
pop = [1.0, 1.262, 1.650, 2.519, 3.692, 5.263, 6.972, 10.85]
values = [0,0.6,1.4,1.6,2.2,2.5,2.6,3.2,3.5,3.9,4.2,6]
# plt.scatter(year, pop)
# # plt.plot(year, pop)
# plt.xlabel('Year')
# plt.ylabel('Population')
# plt.title('World Population')
# plt.yticks([0, 2, 4, 6, 8, 10],
# ['0', '2 Mrd', '4 Mrd',
# '6 Mrd', '8 Mrd', '10 Mrd'])
# plt.show()
# plt.figure()
f, ax = plt.subplots(1,2, figsize=(3,1))
ax[0].plot(year, pop)
ax[1].hist(values, bins=3)
plt.tight_layout()
plt.show()