Grouped plotly polar chart


I want a grouped polar bar plot like this with plotly express.

I tried using barmode = ‘group’ but seems like plotly ignores it and switches to default ‘stacked’.

I do not care about annotations but any help in achieving the grouped polar plot will be highly appreciated.

Something like this?

import plotly.express as px
import pandas as pd

df = pd.DataFrame(
    [
        ["a", 2, "group1"],
        ["b", 2.5, "group1"],
        ["c", 1.6, "group1"],
        ["d", 2.2, "group1"],
        ["e", 1.3, "group2"],
        ["f", 2.1, "group2"],
        ["g", 3.1, "group2"],
        ["h", 2.8, "group3"],
        ["i", 2.7, "group3"],
        ["j", 2.9, "group3"],
        ["k", 1.5, "group3"],
    ],
    columns=["theta", "r", "group"],
)

px.bar_polar(
    df,
    r="r",
    theta="theta",
    color="group",
).update_layout(
    polar_hole=0.25,
    height=600,
    width=800,
    margin=dict(b=30, t=30, l=0, r=0)
)

1 Like