- 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 remove or hide X-axis labels from a Seaborn / Matplotlib plot?
To remove or hide X-axis labels from a Seaborn / Matplotlib plot, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Use sns.set_style() to set an aesthetic style for the Seaborn plot.
Load an example dataset from the online repository (requires Internet).
To hide or remove X-axis labels, use set(xlabel=None).
To display the figure, use 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) ax.set(xlabel=None) plt.show()
Output
Advertisements