Hi again,
I can’t make the same solution work for me.
The input and format I get from clicking a row is:
{ 'row': 0, 'petal_length': 4.7, 'petal_width': 1.2, 'sepal_length': 6.1, 'sepal_width': 2.8}
So I use this input in my update_parallel_coordinates_plot:
@app.callback(
Output("parallel-coordinates-plot", "figure"),
[Input("data_set", "data"),
Input("get_class_dropdown", "value"),
Input("row", "data")],
)
def update_parallel_coordinates_plot(df, class_input, clicked_cell):
"""
Callback that updates the parallel coordinates plot
:param df: dataframe
:param class_input: class input
:param clicked_cell: clicked row from table
:return: figure
"""
df_shap = pd.DataFrame(df).copy()
ylimits = get_limits(subset_columns(df_shap))
df = get_df_class(df_shap, class_input)
fig = go.Figure(data=go.Parcoords(
line=dict(color=df['y_pred']),
dimensions=list(get_dimensions(subset_columns(df), ylimits))))
fig.update_traces(labelangle=45)
# If clicked:
# then update the figure giving that one point a particular color
return fig
But I simply cannot figure out how to change the color of that particular row. I was thinking of adding the state of the figure, and using the:
'line': {'color': [1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, 'type': 'parcoords'}],
and select the item in the array corresponding to the row value and change the color that way. But I have not had success with that approach yet.
Also, I’m not sure what this means?
@celia is on the road.