Skip to content
Advertisement

Make subplots using plotly express with values coming from a dataframe

Assuming I have a toy model df which lists the model of the car and customer rating of one car showroom.

JavaScript

Using plotly express, I created pie charts of percentage of cars by model and by Cust_rating, respectively as two separate graphs:

JavaScript

Now, I want to create subplots, and all the ways of doing it using the documentation are throwing up errors:

JavaScript

This is what I tried:

JavaScript

Advertisement

Answer

A pie chart in a graph object requires a pair of labels and values. You must also specify the plot type in the subplot. See this for an example of a subplot type.

JavaScript

enter image description here

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement