@@ -470,9 +470,12 @@ for continent in df['continent'].unique():
470470 fig_dict[continent] = px.scatter(continent_data, x='gdpPercap', y='lifeExp',
471471 title=f'GDP vs Life Expectancy for {continent}',
472472 labels={'gdpPercap': 'GDP per Capita (USD)', 'lifeExp': 'Life Expectancy (Years)'},
473- hover_name='country',
473+ hover_name='country',size="pop", size_max=55
474474 )
475- #Standardizing the axes would make the graphs easier to compare
475+ #Standardizing the axes makes the graphs easier to compare
476+ fig_dict[continent].update_xaxes(range=[0,50000])
477+ fig_dict[continent].update_yaxes(range=[25,90])
478+
476479
477480# Create a dictionary, data_for_jinja with two entries:
478481# the value for the "dropdown_entries" key is a string containing a series of <option> tags, one tag for each item in the drop down
@@ -485,7 +488,8 @@ for n, figname in enumerate(fig_dict.keys()):
485488 data_for_jinja["dropdown_entries"]+=f"<option value='{figname}'>{fig_dict[figname].layout.title.text}</option>"
486489 #YOU MAY NEED TO UPDATE THE LINK TO THE LATEST PLOTLY.JS
487490 fig_html = fig_dict[figname].to_html(full_html=False, config=dict(responsive=False, scrollZoom=False, doubleClick=False), include_plotlyjs = "https://cdn.plot.ly/plotly-2.35.2.min.js")
488- data_for_jinja["divs"]+=f'<div id="{figname}" class="content-div" {"style=""display:none;"""*(n>0)}>{fig_html}{text_dict[figname]}</div>'
491+ initially_hide_divs_other_than_the_first = "style=""display:none;"""*(n>0)
492+ data_for_jinja["divs"]+=f'<div id="{figname}" class="content-div" {initially_hide_divs_other_than_the_first}>{fig_html}{text_dict[figname]}</div>'
489493
490494# Insert data into the template and write the file to disk
491495# YOU WILL LIKELY NEED TO CUSTOMIZE THESE PATHS
0 commit comments