Skip to content

Commit

Permalink
add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardchalstrey1 committed Jul 12, 2024
1 parent a5d592a commit 4a5df21
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions notebooks/map_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,35 @@ def display_map(gdf, display_year):

# Define a function to be called when the value of the text box changes
def on_value_change(change):
"""
This function is called when the value of the text box or slider changes.
It calls create_map with the newly selected year and the GeoDataFrame gdf.
It sets the components parameter based on the current value of the radio button.
Args:
change (dict): A dictionary containing information about the change.
Returns:
None
"""
if components_radio.value == 'Polities':
create_map(change['new'], gdf, map_output)
elif components_radio.value == 'Components':
create_map(change['new'], gdf, map_output, components=True)

# Define a function to be called when the value of the radio button changes
def on_radio_change(change):
"""
This function is called when the value of the radio button changes. It calls
create_map with the newly selected year of the text box and the GeoDataFrame gdf.
It sets the components parameter based on the current value of the radio button.
Args:
change (dict): A dictionary containing information about the change.
Returns:
None
"""
if change['new'] == 'Polities':
create_map(year_input.value, gdf, map_output)
elif change['new'] == 'Components':
Expand Down

0 comments on commit 4a5df21

Please sign in to comment.