设置顶部是 seaborn 箱线图
setting ylim on seaborn boxplot
是否可以在 seaborn 箱线图上设置 ylim 参数?
举个例子:
y = np.random.randn(300)
sns.boxplot (y=y)
显示器
boxplot
但如果我尝试
ax.set_ylim=(-5, 5)
没有区别。是否可以为箱线图设置不同于给定数据集图的默认值的 ylim 值?
您在没有轴对象的情况下使用轴方法。
尝试(基于图形的方法):
import matplotlib.pyplot as plt
plt.ylim([-5,5])
或者您的情况可能更好:
ax = sns.boxplot (y=y)
ax.set_ylim([-5, 5]) # function! your code-sample is wrong here!
docs here 显示 sns.boxplot 的 return 值。
是否可以在 seaborn 箱线图上设置 ylim 参数?
举个例子:
y = np.random.randn(300)
sns.boxplot (y=y)
显示器
boxplot
但如果我尝试
ax.set_ylim=(-5, 5)
没有区别。是否可以为箱线图设置不同于给定数据集图的默认值的 ylim 值?
您在没有轴对象的情况下使用轴方法。
尝试(基于图形的方法):
import matplotlib.pyplot as plt
plt.ylim([-5,5])
或者您的情况可能更好:
ax = sns.boxplot (y=y)
ax.set_ylim([-5, 5]) # function! your code-sample is wrong here!
docs here 显示 sns.boxplot 的 return 值。