- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 can Seaborn library be used to display categorical scatter plots in Python?
Seaborn is a library that helps in visualizing data. It comes with customized themes and a high level interface.
General scatter plots, histograms, etc can’t be used when the variables that need to be worked with are categorical in nature. This is when categorical scatterplots need to be used.
Plots such as ‘stripplot’, ‘swarmplot’ are used to work with categorical variables. The ‘stripplot’ function is used when atleast one of the variable is categorical. The data is represented in a sorted manner along one of the axes.
Syntax of stripplot function
seaborn.stripplot(x, y,data,…)
Let us see how ‘stripplot’ function can be used to plot categorical variables in a dataset.
Example
import pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_dataset('iris') sb.stripplot(x = "species", y = "sepal_length", data = my_df) plt.show()
Output
Explanation
- The required packages are imported.
- The input data is ‘iris_data’ which is loaded from the scikit learn library.
- This data is stored in a dataframe.
- The ‘load_dataset’ function is used to load the iris data.
- This data is visualized using the ‘stripplot’ function.
- Here, the dataframe is supplied as parameter.
- We can see that certain values are being overlapped.
- Also, the x and y values are specified.
- This data is displayed on the console.
- Related Articles
- How can Seaborn library be used to display a Scatter Plot in Python?
- How can Seaborn library be used to visualize point plots in Python?
- How can Seaborn library be used to display kernel density estimations in Python?
- How can Seaborn library be used to display a hexbin plot in Python?
- How can seaborn library be used to display data without the background axis spines in Python?
- How can bar plot be used in Seaborn library in Python?
- How can FacetGrid be used to visualize data in Python Seaborn Library?
- How can the countplot be used to visualize data in Python Seaborn Library?
- How to avoid the points getting overlapped while using stripplot in categorical scatter plot Seaborn Library in Python?
- How can Bokeh library be used to plot horizontal bar plots using Python?
- How Seaborn library used to display a kernel density estimation plot (joinplot) in Python?
- How can data be represented visually using ‘seaborn’ library in Python?
- How can Pygal be used to generate line plots in Python?
- How can Pygal be used to generate box plots in Python?
- How can Pygal be used to generate dot plots in Python?

Advertisements