How to make grouped box plot in plotly?

This recipe helps you make grouped box plot in plotly

Recipe Objective

How to make grouped box plot in plotly?

Grouped Box plot this is a plot where the categories are being organized in groups or sub-groups, the plotting can be done from the both indexed data and raw data. It is very useful in understanding and also takes very less space in layout.

Step 1 - Import library

import plotly.graph_objects as go

Step 2 - Take Sample data

x_axis = ['a1','a1','a1','b1','b1','b1'] y1 = [1,3,5,7,9,11] y2 = [2,4,6,8,10,12] y3 = [3,6,9,12,15,18]

Step 3 - Plot graph

fig = go.Figure() fig.add_trace(go.Box(y=y1, x=x_axis, name="First", marker_color= "red")) fig.add_trace(go.Box(y=y2, x=x_axis, name="Second", marker_color= "green")) fig.add_trace(go.Box(y=y3, x=x_axis, name="Third", marker_color= "yellow")) fig.update_layout(boxmode="group")

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 CI/CD Pipeline for Machine Learning Projects using Jenkins
In this project, you will learn how to create a CI/CD pipeline for a search engine application using Jenkins.

OpenCV Project to Master Advanced Computer Vision Concepts
In this OpenCV project, you will learn to implement advanced computer vision concepts and algorithms in OpenCV library using Python.

End-to-End Snowflake Healthcare Analytics Project on AWS-1
In this Snowflake Healthcare Analytics Project, you will leverage Snowflake on AWS to predict patient length of stay (LOS) in hospitals. The prediction of LOS can help in efficient resource allocation, lower the risk of staff/visitor infections, and improve overall hospital functioning.

Insurance Pricing Forecast Using XGBoost Regressor
In this project, we are going to talk about insurance forecast by using linear and xgboost regression techniques.

Learn to Build a Siamese Neural Network for Image Similarity
In this Deep Learning Project, you will learn how to build a siamese neural network with Keras and Tensorflow for Image Similarity.

Predictive Analytics Project for Working Capital Optimization
In this Predictive Analytics Project, you will build a model to accurately forecast the timing of customer and supplier payments for optimizing working capital.

Build a CNN Model with PyTorch for Image Classification
In this deep learning project, you will learn how to build an Image Classification Model using PyTorch CNN

Model Deployment on GCP using Streamlit for Resume Parsing
Perform model deployment on GCP for resume parsing model using Streamlit App.

NLP Project for Beginners on Text Processing and Classification
This Project Explains the Basic Text Preprocessing and How to Build a Classification Model in Python

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.