import matplotlib.pyplot as plt import numpy as np #generate some data x = np.array(range(20)) y = 3 + 0.5 * x + np.random.randn(20) #plot the data plt.plot(x, y, 'bo') plt.show() fig = plt.loglog(x, y, 'rs') fig = plt.semilogx(x, y, 'g^') #generate some random numbers from a normal distribution data = 100 + np.random.randn(500) #make a histogram with 20 bins plt.hist(data, 20) plt.show() plt.hist(data, 20) plt.xlabel('Body Mass (g)', fontsize=20) plt.ylabel('Number of Individuals', fontsize= 20) plt.hist(data, 20) plt.axis([90, 110, 0, 100]) x = np.array(range(20)) y = 3 + 0.5 * x + np.random.randn(20) z = 2 + 0.9 * x + np.random.randn(20) #plot the data plt.plot(x, y, 'bo') plt.hold(True) plt.plot(x, z, 'r^') plt.show() plt.subplot(1, 2, 1) plt.plot(x, y, 'rs') plt.subplot(1, 2, 2) plt.hist(data, 10) plt.show() plt.plot(z, x, 'go') plt.figure() plt.plot(z, y, 'rs')