- 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 get data labels on a Seaborn pointplot?
To get data labels on a Seaborn pointplot, we can take the following steps −
Steps
Set the figure size and adjust the padding between and around the subplots.
Create a dataframe, df, of two-dimensional, size-mutable, potentially heterogeneous tabular data.
Create a pointplot.
Get the axes patches and label; annotate with respective labels.
To display the figure, use show() method.
Example
from matplotlib import pyplot as plt import pandas as pd import seaborn as sns plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame({'a': [1, 3, 1, 2, 3, 1]}) ax = sns.pointplot(df["a"], order=df["a"].value_counts().index) for p, label in zip(ax.patches, df["a"].value_counts().index): ax.annotate(label, (p.get_x() + 0.375, p.get_height() + 0.15)) plt.show()
Output
It will produce the following output −
- Related Articles
- How to remove X or Y labels from a Seaborn heatmap?
- How to remove or hide X-axis labels from a Seaborn / Matplotlib plot?
- How to add a title on Seaborn lmplot?
- Rotate tick labels for Seaborn barplot in Matplotib
- Rotate xtick labels in Seaborn boxplot using Matplotlib
- How to select subset of data with Index Labels?
- How to make Violinpot with data points in Seaborn?
- How to plot time series data with labels in R?
- How to show tick labels on top of a matplotlib plot?
- How to remove the axis tick marks on a Seaborn heatmap?
- How to plot a dashed line on a Seaborn lineplot in Matplotlib?
- How to Add or Move Data Labels in an Excel Chart?
- How to add a legend on Seaborn facetgrid bar plot using Matplotlib?
- How to show minor tick labels on a log-scale with Matplotlib?
- How to plot int to datetime on X-axis using Seaborn?

Advertisements