是否有可以在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.1
fig,ax = plt.subplots()
plt.plot(x,y)
ax.set_ylim(ymin,ymax)
但当我添加新数据时,限制会自动调整吗
目前没有回答
相关问题 更多 >
编程相关推荐