MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / update_graph

Function update_graph

sagemaker-dash/tutorials/app9.py:74–98  ·  view source on GitHub ↗
(xaxis_column_name, yaxis_column_name, xaxis_type, yaxis_type,
                 year_value)

Source from the content-addressed store, hash-verified

72 Input('xaxis-type', 'value'), Input('yaxis-type', 'value'),
73 Input('year--slider', 'value'))
74def update_graph(xaxis_column_name, yaxis_column_name, xaxis_type, yaxis_type,
75 year_value):
76 dff = df[df['Year'] == year_value]
77
78 fig = px.scatter(
79 x=dff[dff['Indicator Name'] == xaxis_column_name]['Value'],
80 y=dff[dff['Indicator Name'] == yaxis_column_name]['Value'],
81 hover_name=dff[dff['Indicator Name'] ==
82 yaxis_column_name]['Country Name'])
83
84 fig.update_layout(margin={
85 'l': 40,
86 'b': 40,
87 't': 10,
88 'r': 0
89 },
90 hovermode='closest')
91
92 fig.update_xaxes(title=xaxis_column_name,
93 type='linear' if xaxis_type == 'Linear' else 'log')
94
95 fig.update_yaxes(title=yaxis_column_name,
96 type='linear' if yaxis_type == 'Linear' else 'log')
97
98 return fig
99
100
101if __name__ == '__main__':

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected