- 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
Rotate xtick labels in Seaborn boxplot using Matplotlib
To rotate xtick labels in Seaborn boxplot, we can take the following steps −
Create data points for xticks.
Draw a boxplot using boxplot() method that returns the axis.
Now, set the xticks using set_xticks() method, pass xticks.
Set xticklabels and pass a list of labels and rotate them by passing rotation=45, using set_xticklabels() method.
To display the figure, use show() method.
Example
import seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True xticks = [1, 4, 5, 2, 3] ax = sns.boxplot(xticks) ax.set_xticks(xticks) ax.set_xticklabels(["one", "two", "three", "four", "five"], rotation=45) plt.show()
Output
- Related Articles
- How can I rotate xtick labels through 90 degrees in Matplotlib?
- How to put xtick labels in a box matplotlib?
- Rotate tick labels for Seaborn barplot in Matplotib
- How can I make the xtick labels of a plot be simple drawings using Matplotlib?
- How to rotate tick labels in a subplot in Matplotlib?
- How to set the range of Y-axis for a Seaborn boxplot using Matplotlib?
- How to color a Seaborn boxplot based on DataFrame column name in Matplotlib?
- How to remove or hide X-axis labels from a Seaborn / Matplotlib plot?
- How to edit the properties of whiskers, fliers, caps, etc. in a Seaborn boxplot in Matplotlib?
- Auto adjust font size in Seaborn heatmap using Matplotlib
- Add minor gridlines to Matplotlib plot using Seaborn
- Wrapping long Y labels in Matplotlib tight layout using setp
- How to adjust transparency (alpha) in Seaborn pairplot using Matplotlib?
- How to change the figuresize using Seaborn factorplot in Matplotlib?
- How to plot multiple Seaborn Jointplot in Subplot using Matplotlib?

Advertisements