坐标轴
plt
.figure
(figsize
=(8,3))
plt
.subplot
(131)
fig
= plt
.gca
()
plt
.plot
(x
,y
)
plt
.subplot
(132)
fig
= plt
.gca
()
plt
.plot
(x
,y
)
fig
.axes
.get_xaxis
().set_visible
(False)
fig
.axes
.get_yaxis
().set_visible
(False)
plt
.subplot
(133)
fig
= plt
.gca
()
plt
.plot
(x
,y
)
fig
.spines
['top'].set_visible
(False)
fig
.spines
['right'].set_visible
(False)
x轴标签倾斜
labels
= ['andy' for i
in range(10)]
fig
,ax
= plt
.subplots
()
plt
.plot
(x
,y
)
plt
.title
('andy')
ax
.set_xticklabels
(labels
,rotation
= 45,horizontalalignment
='right')
图例
x
= np
.arange
(10)
plt
.figure
(figsize
=(12,8))
plt
.subplot
(221)
for i
in range(1,4):
plt
.plot
(x
,i
*x
**2,label
= 'Group %d'%i
)
plt
.legend
(loc
='best')
ax
=plt
.subplot
(222)
for i
in range(1,4):
plt
.plot
(x
,i
*x
**2,label
= 'Group %d'%i
)
ax
.legend
(loc
='upper center',bbox_to_anchor
= (0.5,1.15) ,ncol
=3)
plt
.subplot
(223)
for i
in range(1,4):
plt
.plot
(x
,i
*x
**2,label
= 'Group %d'%i
,marker
='o')
plt
.legend
(loc
='upper right',framealpha
= 0.1)
ax
=plt
.subplot
(224)
for i
in range(1,4):
plt
.plot
(x
,i
*x
**2,label
= 'Group %d'%i
)
ax
.legend
(loc
='upper center',bbox_to_anchor
= (1.15,1) ,ncol
=1)
转载请注明原文地址:https://ipadbbs.8miu.com/read-11374.html