图像代码:
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams[‘font.sans-serif’] = [‘SinHei’] #用来正常显示中文标签
plt.rcParams[‘axes.unicode_minus’] = False #用来正常显示负号
import numpy as np
x = np.linspace(0.05,10,1000)
y = np.sin(x)

plt.plot(x,y)
ax = plt.gca()
ax.spines[‘right’].set_color(‘red’)
ax.spines[‘left’].set_color(‘red’)
ax.spines[‘top’].set_color(‘yellow’)
ax.spines[‘bottom’].set_color(‘yellow’)

本文介绍如何使用Python的Matplotlib库和NumPy库来绘制一个带有特定颜色轴的正弦波图形。通过设置字体、调整轴的颜色,实现了中文标签的正常显示和美观的图形效果。
1612

被折叠的 条评论
为什么被折叠?



