Explain how to Plot categorical data using seaborn?

This recipe explains how to Plot categorical data using seaborn

Recipe Objective

Plot categorical data using seaborn.

Categorical data is data which are having repeating values present in it the values could binary or numerical or string values, for e.g. Male and female, 0 and 1, True and false and more. Lets understand how to visualize them.

Step 1 - Import the necessary values

import seaborn as sns import matplotlib.pyplot as plt

Step 2 - load the dataset

titanic_data = sns.load_dataset('titanic') titanic_data.head()

Step 3 - Plot the graph with different examples

sns.catplot(x='survived',y='age', data=titanic_data) sns.catplot(x='survived',y='age', kind="swarm", data=titanic_data) sns.catplot(x='survived',y='age', jitter=False, data=titanic_data)

Here from the above figures: x - denotes which variable to be plot on x-axis y - denotes which variable to be plot on y-axis data - denotes the Sample data name that we have taken. kind - denotes which type of graph we want for plotting for e.g bar, scatter, violin etc.

What Users are saying..

profile image

Gautam Vermani

Data Consultant at Confidential
linkedin profile url

Having worked in the field of Data Science, I wanted to explore how I can implement projects in other domains, So I thought of connecting with ProjectPro. A project that helped me absorb this topic... Read More

Relevant Projects

Recommender System Machine Learning Project for Beginners-2
Recommender System Machine Learning Project for Beginners Part 2- Learn how to build a recommender system for market basket analysis using association rule mining.

Build Multi Class Text Classification Models with RNN and LSTM
In this Deep Learning Project, you will use the customer complaints data about consumer financial products to build multi-class text classification models using RNN and LSTM.

Deep Learning Project for Text Detection in Images using Python
CV2 Text Detection Code for Images using Python -Build a CRNN deep learning model to predict the single-line text in a given image.

Learn How to Build PyTorch Neural Networks from Scratch
In this deep learning project, you will learn how to build PyTorch neural networks from scratch.

Credit Card Default Prediction using Machine learning techniques
In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

Expedia Hotel Recommendations Data Science Project
In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

Avocado Machine Learning Project Python for Price Prediction
In this ML Project, you will use the Avocado dataset to build a machine learning model to predict the average price of avocado which is continuous in nature based on region and varieties of avocado.

MLOps Project for a Mask R-CNN on GCP using uWSGI Flask
MLOps on GCP - Solved end-to-end MLOps Project to deploy a Mask RCNN Model for Image Segmentation as a Web Application using uWSGI Flask, Docker, and TensorFlow.

Build a Hybrid Recommender System in Python using LightFM
In this Recommender System project, you will build a hybrid recommender system in Python using LightFM .

Build a Similar Images Finder with Python, Keras, and Tensorflow
Build your own image similarity application using Python to search and find images of products that are similar to any given product. You will implement the K-Nearest Neighbor algorithm to find products with maximum similarity.