@@ -470,9 +470,12 @@ for continent in df['continent'].unique():
470
470
fig_dict[continent] = px.scatter(continent_data, x='gdpPercap', y='lifeExp',
471
471
title=f'GDP vs Life Expectancy for {continent}',
472
472
labels={'gdpPercap': 'GDP per Capita (USD)', 'lifeExp': 'Life Expectancy (Years)'},
473
- hover_name='country',
473
+ hover_name='country',size="pop", size_max=55
474
474
)
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
+
476
479
477
480
# Create a dictionary, data_for_jinja with two entries:
478
481
# 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()):
485
488
data_for_jinja["dropdown_entries"]+=f"<option value='{figname}'>{fig_dict[figname].layout.title.text}</option>"
486
489
#YOU MAY NEED TO UPDATE THE LINK TO THE LATEST PLOTLY.JS
487
490
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>'
489
493
490
494
# Insert data into the template and write the file to disk
491
495
# YOU WILL LIKELY NEED TO CUSTOMIZE THESE PATHS
0 commit comments