pyplot's plot() function

plt.plot(x,y,format_string,**kwargs)
When drawing multiple curves, the x of each curve cannot be omitted, and x can be omitted when drawing only one curve.

Example 1: Draw four curves:

import matplotlib.pyplot as plt
import numpy as np

a = np.arange(10)
plt.plot(a,a*1.5,a,a*2.5,a,a*3.5,a,a*4.5)
plt.show()

Results:
Insert picture description here
1. Color characters
Insert picture description here
2. Style characters
Insert picture description here
3. Marking characters
Insert picture description hereInsert picture description here
Insert picture description here
Insert picture description here

Example 2: Add style

import matplotlib.pyplot as plt
import numpy as np

a = np.arange(10)
plt.plot(a,a*1.5,'go-',a,a*2.5,'rx',a,a*3.5,'*',a,a*4.5,'b-.')
plt.show()

result:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_42253964/article/details/106869512