可以使用 'arrowstyle' 参数设置箭头样式,使用 'linewidth' 参数设置箭头粗细。例如:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

ax.plot([0, 1], [0, 1])

ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)

ax.spines['left'].set_linewidth(2)
ax.spines['bottom'].set_linewidth(2)

ax.spines['left'].set_arrowstyle('->', linewidth=2)
ax.spines['bottom'].set_arrowstyle('->', linewidth=2)

plt.show()

运行结果如下:

image.png

Matplotlib 坐标轴箭头:添加箭头并调整粗细

原文地址: https://www.cveoy.top/t/topic/m1s1 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录