Using python “matplotlib.pyplot“ draw a beautiful picture

DONNOT USE PLT FOR ANYTHING, INSTEAD FIGURE AND AX

Don not use the one below

plt.plot(your data)
plt.(xxxx) # xxxxs are the operations of plt
plt.show() # static show method, different from figure.show()

the easy version

figure = plt.figure() # there is a param called figsize= many inches
ax1 = figure.add_subplot(121) # rows columns index
ax1.plot(your data )
ax2 = figure.add_subplot(122) # rows columns index
ax2.plot(your data)
plt.show() # static show method, different from figure.show()

a mostly used one

figure, axes = plt.subplots(2, 1)
axes[0].plot([1, 2, 3], [1, 2, 3])
axes[1].plot([2, 2, 3], [1, 2, 3])
plt.show()

However, when I use this method in pycharm, axes[0].(xxxx), xxxxs are not be prompted, which is not a good one to use when you are a green hand one in programing.

你可能感兴趣的:(python,matplotlib,开发语言,画图,plt)