Example 1: import matplotlib plt
import matplotlib.pyplot as plt
Example 2: matplotlib plot
import matplotlib.pyplot as plt
fig = plt.figure(1)
plt.title("Y vs X", fontsize='16')
plt.plot([1, 2, 3, 4], [6,2,8,4])
plt.xlabel("X",fontsize='13')
plt.ylabel("Y",fontsize='13')
plt.legend(('YvsX'),loc='best')
plt.savefig('Y_X.png')
plt.grid()
plt.show()
Example 3: matplotlib
from matplotlib import pyplot as plt
plt.plot([1,2,3],[4,5,1])
plt.show()
Example 4: matplotlib.pyplot
plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
Example 5: matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Polygon
np.random.seed(19680801)
spread = np.random.rand(50) * 100
center = np.ones(25) * 50
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
data = np.concatenate((spread, center, flier_high, flier_low))
fig, axs = plt.subplots(2, 3)
axs[0, 0].boxplot(data)
axs[0, 0].set_title('basic plot')
axs[0, 1].boxplot(data, 1)
axs[0, 1].set_title('notched plot')
axs[0, 2].boxplot(data, 0, 'gD')
axs[0, 2].set_title('change outlier\npoint symbols')
axs[1, 0].boxplot(data, 0, '')
axs[1, 0].set_title("don't show\noutlier points")
axs[1, 1].boxplot(data, 0, 'rs', 0)
axs[1, 1].set_title('horizontal boxes')
axs[1, 2].boxplot(data, 0, 'rs', 0, 0.75)
axs[1, 2].set_title('change whisker length')
fig.subplots_adjust(left=0.08, right=0.98, bottom=0.05, top=0.9,
hspace=0.4, wspace=0.3)
spread = np.random.rand(50) * 100
center = np.ones(25) * 40
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
d2 = np.concatenate((spread, center, flier_high, flier_low))
data = [data, d2, d2[::2]]
fig, ax = plt.subplots()
ax.boxplot(data)
plt.show()