← 返回章节索引

CHAPTER 06 · 作品已接入

任意位置添加

用数据坐标定位轴线,适配零基线图表。

10075502500246810 zero line Axis at Custom Position X axis Y axis
import matplotlib.pyplot as plt

ax = plt.gca()
ax.spines['bottom'].set_position(('data', 0))
ax.plot(x, y)
plt.show()
移动轴任意位置添加