Python 如何将轴限制设置为围绕matplotlib中的点对称?
是否有可以在matplotlib中设置的选项,以便轴限制始终围绕给定值对称 像这样的东西Python 如何将轴限制设置为围绕matplotlib中的点对称?,python,matplotlib,Python,Matplotlib,是否有可以在matplotlib中设置的选项,以便轴限制始终围绕给定值对称 像这样的东西 import numpy as np import matplotlib.pyplot as plt x = np.arange(10) y = np.random.uniform(0,1,10) center = 0.5 maxdiff = np.max(np.abs(y-center)) ymin = center-maxdiff - 0.1 ymax = center+maxdiff + 0
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = np.random.uniform(0,1,10)
center = 0.5
maxdiff = np.max(np.abs(y-center))
ymin = center-maxdiff - 0.1
ymax = center+maxdiff + 0.1
fig,ax = plt.subplots()
plt.plot(x,y)
ax.set_ylim(ymin,ymax)
但当我添加新数据时,限制会自动调整吗