更改图表的显示

时间:2015-01-08 11:24:25

标签: python graph

我使用python获得了以下图表。

enter image description here

python中是否有内置函数可用于移动图形? 这样整个图形将移动到y坐标为0.5的点的位置将出现在图形的中心。

所以我会得到以下几点。

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以将轴原点放在任何数据点,它看起来像这样

fig, ax = plt.subplots()
ax.plot(x, y)
ax.spines['left'].set_position(('data', 2.1))
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_position(('data', 0.5))
ax.spines['top'].set_color('none')