Python 如何为seaborn boxplot设置y轴的范围?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33227473/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 13:03:05 来源:igfitidea点击:
How to set the range of y-axis for a seaborn boxplot?
提问by Xin
From the official seaborn documentation, I learned that you can create a boxplot as below:
从官方的 seaborn 文档中,我了解到您可以创建一个箱线图,如下所示:
import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.boxplot(x="day", y="total_bill", data=tips)
My question is: how do I limit the range of y-axis of this plot? For example, I want the y-axis to be within [10, 40]. Is there any easy way to do this?
我的问题是:如何限制该图的 y 轴范围?例如,我希望 y 轴在 [10, 40] 内。有什么简单的方法可以做到这一点吗?