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

Ray han

Tech Leader | Stanford / Yale University
linkedin profile url

I think that they are fantastic. I attended Yale and Stanford and have worked at Honeywell,Oracle, and Arthur Andersen(Accenture) in the US. I have taken Big Data and Hadoop,NoSQL, Spark, Hadoop... Read More

Relevant Projects

Forecasting Business KPI's with Tensorflow and Python
In this machine learning project, you will use the video clip of an IPL match played between CSK and RCB to forecast key performance indicators like the number of appearances of a brand logo, the frames, and the shortest and longest area percentage in the video.

End-to-End Snowflake Healthcare Analytics Project on AWS-2
In this AWS Snowflake project, you will build an end to end retraining pipeline by checking Data and Model Drift and learn how to redeploy the model if needed

Build an Image Segmentation Model using Amazon SageMaker
In this Machine Learning Project, you will learn to implement the UNet Architecture and build an Image Segmentation Model using Amazon SageMaker

AWS MLOps Project for Gaussian Process Time Series Modeling
MLOps Project to Build and Deploy a Gaussian Process Time Series Model in Python on AWS

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.

AWS MLOps Project to Deploy a Classification Model [Banking]
In this AWS MLOps project, you will learn how to deploy a classification model using Flask on AWS.

Digit Recognition using CNN for MNIST Dataset in Python
In this deep learning project, you will build a convolutional neural network using MNIST dataset for handwritten digit recognition.

Ensemble Machine Learning Project - All State Insurance Claims Severity Prediction
In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

Learn to Build a Polynomial Regression Model from Scratch
In this Machine Learning Regression project, you will learn to build a polynomial regression model to predict points scored by the sports team.

Loan Eligibility Prediction using Gradient Boosting Classifier
This data science in python project predicts if a loan should be given to an applicant or not. We predict if the customer is eligible for loan based on several factors like credit score and past history.