This article discusses the role of matplotlib in data visualization using Python, it provides several useful methods for rendering graphs, some of which are:
Plotting:
matplotlib
, you can use the method plot
to generate figures, x-axis and y-axis values are provided usually as arrays.plot
method, the following draws 2 lines with different colors
plt.figure(figsize=(10,6), dpi=80)
plt.plot(X, C, color=”blue”, linewidth=2.5, linestyle=”-“)
plt.plot(X, S, color=”red”, linewidth=2.5, linestyle=”-“)
plt.xlim(X.min()1.1, X.max()1.1)
plt.ylim(C.min()1.1, C.max()1.1)
plt.xticks( [-np.pi, -np.pi/2, 0, np.pi/2, np.pi])
plt.yticks([-1, 0, +1])
To change the tick lable use plt.xticks
and plt.yticks
:
Consider spines as the borders of the last graph, their position can be changed using .spines
Many other methods for modifying graphs can be found here