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

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

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.

Relevant Projects

Walmart Sales Forecasting Data Science Project
Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.

Human Activity Recognition Using Multiclass Classification in Python
In this human activity recognition project, we use multiclass classification machine learning techniques to analyse fitness dataset from a smartphone tracker.

Time Series Analysis Project in R on Stock Market forecasting
In this time series project, you will build a model to predict the stock prices and identify the best time series forecasting model that gives reliable and authentic results for decision making.

Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

Build OCR from Scratch Python using YOLO and Tesseract
In this deep learning project, you will learn how to build your custom OCR (optical character recognition) from scratch by using Google Tesseract and YOLO to read the text from any images.

Data Science Project - Instacart Market Basket Analysis
Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

Predict Employee Computer Access Needs in Python
Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

Data Science Project in Python on BigMart Sales Prediction
The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

Abstractive Text Summarization using Transformers-BART Model
Deep Learning Project to implement an Abstractive Text Summarizer using Google's Transformers-BART Model to generate news article headlines.

Image Segmentation using Mask R-CNN with Tensorflow
In this Deep Learning Project on Image Segmentation Python, you will learn how to implement the Mask R-CNN model for early fire detection.