Control color
Color |
Color Name |
B |
Blue |
C |
Cyan |
G |
Green |
K |
Black |
M |
Magenta |
R |
Red |
W |
White |
Y |
Yellow |
Plt.plot (x1, y1, fmt1, x2, y2, fmt2, ...) Style of the control line
Style |
Style |
- |
Solid line |
-- |
Dashed line |
-. |
Dash-dot Line |
: |
Dotted line |
Control marker Style
. |
Point marker |
, |
Pixel Marker |
O |
Circle Marker |
V |
Triangle down |
^ |
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 Marker |
+ |
Plus Marker |
X |
Cross Marker |
D |
Diamond Marker |
D |
Thin Diamond Marker |
| |
Vertical Line |
_ |
Horizontal line |
Use keyword parameters for better control of ticks label values for x and y plotting type histogram chart = Histogram Charts error Bar Chartsbar Charts This summary code example
Import Matplotlib.pyplot as Pltimport numpy as Npy = Np.arange (1, 3) plt.plot (y, ' y ') plt.plot (y+1, ' m ') plt.plot (y+2, ' c ') pl T.show () Import Matplotlib.pyplot as Pltimport numpy as Npy = Np.arange (1, 3) plt.plot (Y, '--', y+1, '-. ', y+2, ': ') plt.show () Import Matplotlib.pyplot as Pltimport numpy as Npy = Np.arange (1, 3, 0.2) plt.plot (y, ' x ', y+0.5, ' O ', y+1, ' D ', y+1.5, ' ^ ', y+2, ' s ') plt.show () import Matplotlib.pyplot as Pltimport numpy as Npy = Np.arange (1, 3, 0.3) Plt.plot (y, ' cx--', y+1, ' MO: ', y+2, ' kp-. ') Plt.show () Import Matplotlib.pyplot as Pltimport numpy as Npy = Np.arange (1, 3, 0.3) Plt.plot (y, color= ' blue ', linestyle= ' da Shdot ', linewidth=4, marker= ' o ', markerfacecolor= ' red ', markeredgecolor= ' black ', markeredgewidth=3, marker size=12) plt.show () import matplotlib.pyplot as Pltx = [5, 3, 7, 2, 4, 1]plt.plot (x) plt.xticks (range (len (x)), [' A ', ' B ', ' C ' , ' d ', ' e ', ' f ']) Plt.yticks (range (1, 8, 2)) plt.show () import Matplotlib.pyplot as Pltimport numpy as Npy = Np.random.randn ( ) pLt.hist (y) plt.show () plt.hist (y, x) plt.show () import Matplotlib.pyplot as Pltimport numpy as Npx = Np.arange (0, 4, 0.2) y = Np.exp (-X) e1 = 0.1 * Np.abs (NP.RANDOM.RANDN (len (y))) Plt.errorbar (x, Y, yerr=e1, fmt= '.-') plt.show () e2 = 0.1 * Np.abs (NP.R Andom.randn (len (y))) Plt.errorbar (x, Y, Yerr=e1, xerr=e2, fmt= '.-', capsize=0) plt.show () Plt.errorbar (x, Y, Yerr=[e1, E2 ], fmt= '.-') plt.show () Import Matplotlib.pyplot as Pltplt.bar ([1, 2, 3], [3, 2, 5]) plt.show () import matplotlib.pyplot as Pl Timport numpy as Npdata1 = 10*np.random.rand (5) data2 = 10*np.random.rand (5) data3 = 10*np.random.rand (5) e2 = 0.5*np.abs (NP . RANDOM.RANDN (Len (data2))) Locs = Np.arange (1, Len (data1) +1) width = 0.27plt.bar (locs+width, data2, Yerr=e2, Width=width , color= ' red ') Plt.bar (Locs+2*width, data3, width=width, color= ' green ') plt.show ()
Knowledge lies in a little bit of accumulation, I will be on this road go ahead,
lucky to see my blog friends, if you can learn knowledge, please pay more attention and discussion, let us progress together, set sail. PostScript: A piece of Limerick
Moderate exercise, quantitative indicators
Considering the weather, setting goals
Scientific exercise, achievement body Standard
Efficient scientific research to achieve learning standard
Python3 Drawing Library Matplotlib (02)