What is factor plot and how make a factor plot using seaborn?

This recipe explains what is factor plot and how make a factor plot using seaborn

Recipe Objective

what is factor plot? Make a factor plot using seaborn.

Factor plot these plots are used for plotting various types of categorical plot. By default it gives the output of point plot, but by using the kind parameter we can plot other categorical plot.

Step 1 - Import the necessary library

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

sns.factorplot(x ='survived', y ='age', data = titanic_data) sns.factorplot(x ='survived', y ='fare', data = titanic_data) plt.show() sns.factorplot(x ='pclass', y ='age', data = titanic_data, kind='violin') plt.show() sns.factorplot(x ='pclass', y ='age', data = titanic_data, kind='bar') plt.show()

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

Ameeruddin Mohammed

ETL (Abintio) developer at IBM
linkedin profile url

I come from a background in Marketing and Analytics and when I developed an interest in Machine Learning algorithms, I did multiple in-class courses from reputed institutions though I got good... Read More

Relevant Projects

Build an End-to-End AWS SageMaker Classification Model
MLOps on AWS SageMaker -Learn to Build an End-to-End Classification Model on SageMaker to predict a patient’s cause of death.

Build a Credit Default Risk Prediction Model with LightGBM
In this Machine Learning Project, you will build a classification model for default prediction with LightGBM.

Azure Deep Learning-Deploy RNN CNN models for TimeSeries
In this Azure MLOps Project, you will learn to perform docker-based deployment of RNN and CNN Models for Time Series Forecasting on Azure Cloud.

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.

Build an AI Chatbot from Scratch using Keras Sequential Model
In this NLP Project, you will learn how to build an AI Chatbot from Scratch using Keras Sequential Model.

Build a Graph Based Recommendation System in Python-Part 2
In this Graph Based Recommender System Project, you will build a recommender system project for eCommerce platforms and learn to use FAISS for efficient similarity search.

Build a Multi Class Image Classification Model Python using CNN
This project explains How to build a Sequential Model that can perform Multi Class Image Classification in Python using CNN

ML Model Deployment on AWS for Customer Churn Prediction
MLOps Project-Deploy Machine Learning Model to Production Python on AWS for Customer Churn Prediction

MLOps using Azure Devops to Deploy a Classification Model
In this MLOps Azure project, you will learn how to deploy a classification machine learning model to predict the customer's license status on Azure through scalable CI/CD ML pipelines.

Build a Face Recognition System in Python using FaceNet
In this deep learning project, you will build your own face recognition system in Python using OpenCV and FaceNet by extracting features from an image of a person's face.