Create a for loop to generate a new set of graphs in plotly

Hi Everyone! I am generally pretty new to Plotly. I am trying to create a series of dashboards with nearly 12 graphs per institution based on one dataset. I have made a set of graphs for one institution, and I need to do the same for nearly 300 more institutions. Is there a way to just write a for loop in plotly so that the series of graphs can change based on the institution (origin) name?

What I have been doing so far is writing this line:

and then saving those graphs, and then replacing ‘Instituion1’ with ‘Institution2’

I just wonder if there is an easier way to do this? Any help is greatly appreciated!

hi @DeeDee79
:wave: Welcome to the community.

I think that should be possible. Here’s an example with the gapminder data set and the line chart.

import as px

df =

def create_graphs(data):
    for x in data:
        dff = df[df["country"]==x]
        fig = px.line(dff, x="year", y="lifeExp", title=f'Life expectancy in {x}')