Plotly Express Dictionary As Parameters?

Say for example I have generated a plot using Plotly Express like so:
fig= px.box(plot_df, x="name_1", y="name_2", title="Hello Plotly")

Is there a way I can pass in something like a dictionary or other data structure in place of these parameters? For example, could I have something like:

my_dictionary = {
    "x" : "name_1",
    "y" : "name_2",
    "title" : "Hello Plotly"
}

fig = px.box(plot_df, my_dictionary)

Any help would be appreciated!

This should work:

fig = px.box(plot_df, **my_dictionary)

It’s called dictionary unpacking and is a feature of Python itself (not specific to Plotly).

1 Like

Work like a charm, great to know. Thank you so much!