热门

最新

红包

立Flag

投票

同城

我的

发布
mali1914010133
M1914010133
4 年前
truemali1914010133

#fig.set_facecolor((1,0,0)) 设置坐标轴的颜色,其中r、g、b取[0,1]之间的浮点数。


import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 100)
fig = plt.figure(figsize=(8,6),dpi=80)
fig.set_facecolor((1,0,0))
ax1 = fig.add_subplot(2,2,1)
ax1.plot(x, x)
ax1.legend(['y=x'])
ax2 = fig.add_subplot(2,2,2)
ax2.plot(x, -x,'r') ;
ax2.legend(['y=-x'])
ax3 = fig.add_subplot(2,2,3)
ax3.plot(x, x ** 2,'b')
ax3.legend(['y=x*x'])
ax4 = fig.add_subplot(2,2,4)
ax4.plot(x, np.log(x),'g')
ax4.legend(['y=log(x)'],loc='lower right')
plt.show()

CSDN App 扫码分享
分享
评论
1
打赏
  • 复制链接
  • 举报
下一条:
11.2.1 创建画布与创建子图
立即登录