This article is a little note about learning the matplotlib for Python developers
You can set line parameters when plot paint. Includes: color, line style, marking styles.
1) Control color
The corresponding relationship between colors is
b---blue c---cyan g---green k----black
M---magenta r---red w---white y----yellow
There are three ways of representing colors:
A: B:16 with full name: #FF00FF C:rgb or Rgba tuple (1,0,1,1) d: Grayscale intensity such as: ' 0.7 '
2) control line style
The correspondence between the symbol and the line style
-Solid Line
--Short-term
-. Short Point interphase Line
: Virtual Point line
3) control tag style
There are a variety of tag styles:
. Point marker
, Pixel Marker
o Circle Marker
V Triangle down Marker
^ Triangle up marker
< triangle left Marker
> Triangle Right Marker
1 Tripod down Marker
2 Tripod up Marker
3 Tripod left Marker
4 Tripod Right Marker
S Square Marker
P Pentagon Marker
* Star Marker
H Hexagon Marker
H rotated hexagon D Diamond Marker
D Thin Diamond Marker
| Vertical Line (Vlinesymbol) marker
_ Horizontal line (hline symbol) marker
+ Plus Marker
x Cross (x) marker
The following example sets the above three: the specific code and effect are as follows:
Import Matplotlib.pyplot as Plt
import numpy as np
y = np.arange (1, 3, 0.3)
plt.plot (y, ' cx--', y+1, ' Mo: ', y+ 2, ' kp-. ');
Plt.show ()