Mtplotlib-rookie tutorial-part of the code analysis and color graphics

Import drawing module

import matplotlib.pyplot as plt

Magic command

%matplotlib inline
function: embedded drawing, and the step of plt.show() can be omitted.

Create an empty graph

fig = plt.figure()

Create subgraph

ax1 = fig.add_ subplot(2, 2, 1) //(row, column, which
subplot ) ax2 = fig.add_ subplot(2, 2, 2)
ax3 = fig.add_ subplot(2, 2, 3 )

Line color

Black k
white w
red r
yellow y
green g
blue b
blue green c
pink purple m

Detailed reference: https://www.cnblogs.com/darkknightzh/p/6117528.html

Figure

Line chart plot
scatter plot scatter
histogram hist
box plot boxplot

Guess you like

Origin blog.csdn.net/weixin_44039266/article/details/105372623