import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
# 设置背景色
rect = fig.patch
rect.set_facecolor('red')
ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
# 设置背景色
rect = ax1.patch
rect.set_facecolor('y')
for label in ax1.xaxis.get_ticklabels():
# label is a Text instance
label.set_color('red')
label.set_rotation(45)
label.set_fontsize(16)
for line in ax1.yaxis.get_ticklines():
# line is a Line2D instance
line.set_color('green')
line.set_markersize(25)
line.set_markeredgewidth(3)
plt.show()
【Python-Matplotlib】设置figure背景色
最新推荐文章于 2024-10-07 15:27:54 发布