- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the range of Y-axis for a Seaborn boxplot using Matplotlib?
To set the range of Y-axis for a Seaborn boxplot, we can take the following steps −
Using set_style() method, set the aesthetic style of the plots.
Load the dataset using load_dataset("tips"); need Internet.
Using boxplot(), draw a box plot to show distributions with respect to categories.
To set the range of Y-axis, use the ylim() method.
To display the figure, use the show() method.
Example
from matplotlib import pyplot as plt import seaborn as sns plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True sns.set_style("whitegrid") tips = sns.load_dataset("tips") ax = sns.boxplot(x="day", y="total_bill", data=tips) plt.ylim(5, 50) plt.show()
Output
- Related Articles
- How to change the range of the X-axis and Y-axis in Matplotlib?
- How to set the range of Y-axis in Python Plotly?
- How to set the range for boxplot in base R?
- Rotate xtick labels in Seaborn boxplot using Matplotlib
- How to customize the axis label in a Seaborn jointplot using Matplotlib?
- How to repress scientific notation in factorplot Y-axis in Seaborn / Matplotlib?
- How to change the Y axis limit for boxplot created by using ggplot2 in R?
- How to display Matplotlib Y-axis range using absolute values rather than offset values?
- How to annotate a range of the X-axis in Matplotlib?
- Automatically setting Y-axis limits for a bar graph using Matplotlib
- How to color a Seaborn boxplot based on DataFrame column name in Matplotlib?
- How to edit the properties of whiskers, fliers, caps, etc. in a Seaborn boxplot in Matplotlib?
- How to enforce axis range in Matplotlib?
- Set Max value for color bar on Seaborn heatmap using Matplotlib
- How to set the angle of skew on Y-axis of a Rectangle using FabricJS?

Advertisements