Search code examples
pythonplotplotlyplotly-express

Get colors from stacked plot


I have this Plotly plot (blurred sensitive data): plot

which I got using fig = px.bar(stacked, x='Data', y='Kwota', color='Kategoria') from plotly_express.

Is there a way to obtain the colors which were automatically used for categories?


Solution

  • As per this recent answer:

    [...] the default sequence comes from layout.colorway in the active template.

    In the default template called plotly this is the sequence available under px.colors.qualitative.Plotly.

    This sequence is ['#636EFA', '#EF553B', '#00CC96', '#AB63FA', '#FFA15A', '#19D3F3', '#FF6692', '#B6E880', '#FF97FF', '#FECB52']