How to set y-axis range for sea box?

From the official maritime documentation , I found out that you can create a box as shown below:

import seaborn as sns sns.set_style("whitegrid") tips = sns.load_dataset("tips") ax = sns.boxplot(x="day", y="total_bill", data=tips) 

Seaborn Boxplot Example

My question is: how to limit the range of the y axis of this graph? For example, I want the y axis to be within [10, 40]. Is there an easy way to do this?

+18
python matplotlib boxplot seaborn
source share
1 answer

This is the standard matplotlib.pyplot:

 ... import matplotlib.pyplot as plt plt.ylim(10, 40) 

Or easier, as the mwaska comments below:

 ax.set(ylim=(10, 40)) 

enter image description here

+32
source share

All Articles