✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Showing two independent graphs in one canvas / figure

How is it possible to show two independent graphs in one figure (or) together in one row / two columns?

The rendering options I am interested in are:

  1. within jupyter (notebook and lab)
  2. in a standalone browser

I would like to show pie1 and pie2, with their own legends (i.e. not as an integrated sub-group trace) in a canvas, in this sample code:

import plotly.express as px
import plotly.graph_objects as go

import pandas as pd
import string, random

sz=100

df = pd.DataFrame({'caps': pd.Series(random.choice(string.ascii_uppercase) 
                                for _ in range(sz)),
                    'smalls': pd.Series(random.choice(string.ascii_lowercase) 
                                for _ in range(sz))})

pie1 = px.pie(data_frame=df.caps, 
              names=df.caps.value_counts().index, 
              values=df.caps.value_counts().values)

pie2 = px.pie(data_frame=df.smalls, 
              names=df.smalls.value_counts().index, 
              values=df.smalls.value_counts().values)