
1 2 3 4 5 6 7 8 9 10 |
|
1. figure对象
Matplotlib的图像均位于figure对象中。
创建figure: plt.figure()
1 |
|
2. subplot子图
add_subplot:向figure对象中添加子图。
add_subplot(a, b, c):a,b 表示讲fig分割成axb的区域,c 表示当前选中要操作的区域(c从1开始)。
add_subplot返回的是AxesSubplot对象,plot 绘图的区域是最后一次指定subplot的位置
1 2 3 4 |
|
1 2 3 4 5 6 |
|
1 2 3 |
|
1 2 3 4 |
|
1 2 |
|
subplots :生成子图/子图数组
1 2 3 4 5 6 7 8 9 |
|
1 |
|
subplots_adjust:调整subplots的间距
1 |
|
1 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
重叠绘制
legend:显示图例
1 |
|
1 |
|
1 2 3 4 |
|
设置刻度范围:set_xlim、set_ylim
设置显示的刻度:set_xticks、set_yticks
刻度标签:set_xticklabels、set_yticklabels
坐标轴标签:set_xlabel、set_ylabe
l图像标题:set_title
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
3. Plotting functions in pandas
1 2 3 4 5 |
|
1 2 3 4 |
|
1 2 3 4 |
|
A | B | C | D | |
---|---|---|---|---|
0 | -0.523822 | 1.061179 | -0.882215 | -0.267718 |
10 | -0.178175 | -0.367573 | -1.465189 | -1.095390 |
20 | 0.276166 | 0.816511 | -0.344557 | 1.297281 |
30 | 0.529400 | 0.159374 | -2.765168 | 1.784692 |
40 | -1.129003 | -1.665272 | -2.746512 | 3.140976 |
50 | 0.265113 | -1.821224 | -5.140850 | 2.377449 |
60 | -2.699879 | -3.895255 | -5.011561 | 1.715174 |
70 | -2.384257 | -3.480928 | -4.519131 | 2.805369 |
80 | -2.525243 | -3.031608 | -4.840125 | 1.106624 |
90 | -2.020589 | -3.519473 | -4.823292 | 0.522323 |
1 |
|
1 2 3 4 |
|
A | B | |
---|---|---|
0 | 0 | 1 |
1 | 0 | 1 |
2 | 1 | 0 |
3 | 0 | 1 |
4 | 1 | 0 |
5 | 1 | 0 |
6 | 1 | 1 |
7 | 0 | 0 |
8 | 1 | 0 |
9 | 1 | 0 |
1 |
|
1 |
|
1 2 |
|
1 2 3 4 |
|
Genus | A | B | C | D |
---|---|---|---|---|
one | 0.760750 | 0.951159 | 0.643181 | 0.792940 |
two | 0.137294 | 0.005417 | 0.685668 | 0.858801 |
three | 0.257455 | 0.721973 | 0.968951 | 0.043061 |
four | 0.298100 | 0.121293 | 0.400658 | 0.236369 |
five | 0.463919 | 0.537055 | 0.675918 | 0.487098 |
six | 0.798676 | 0.239188 | 0.915583 | 0.456184 |
1 |
|
1 2 3 |
|
1 2 3 4 |
|
1 |
|
更多python相关文章请关注python自学网。