答案 0 :(得分:2)
查看matplotlib spine placement demo,您发现可以使用ax.spines['left'].set_position('zero')
移动刺。
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
x = np.linspace(-3,3)
y = x**2
fig, ax = plt.subplots()
ax.set_ylim(-4,10)
ax.set_xlim(-10,10)
ax.plot(x, y)
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
plt.show()