hlnicholls commited on
Commit
303f06b
1 Parent(s): ca9fc66

Update dynamic_shap_plot.py

Browse files
Files changed (1) hide show
  1. dynamic_shap_plot.py +5 -6
dynamic_shap_plot.py CHANGED
@@ -65,17 +65,16 @@ def summary_plot_plotly_fig(shap_values, df_shap, feature_names, max_display = 8
65
 
66
  feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
67
  feature_order = feature_order[-min(max_display, len(feature_order)):]
68
- text = [feature_names[i] for i in feature_order]
69
  text = iter(text)
70
 
71
  for i in range(1, len(plotly_fig['data']), 2):
72
  t = text.__next__()
73
  plotly_fig['data'][i]['name'] = ''
74
- #plotly_fig['data'][i]['text'] = t
75
  plotly_fig['data'][i]['hoverinfo'] = 'text'
76
- plotly_fig['data'][i]['text'] = df_shap.index
77
- plotly_fig['data'][i]['y'] = [t] * len(df_shap.index)
78
- #plotly_fig['data'][i]['y'] = feature_names[feature_order]
79
 
80
 
81
  colorbar_trace = go.Scatter(x=[None],
@@ -104,7 +103,7 @@ def summary_plot_plotly_fig(shap_values, df_shap, feature_names, max_display = 8
104
  x=1.18,
105
  align="right",
106
  valign="top",
107
- text='Feature value',
108
  showarrow=False,
109
  xref="paper",
110
  yref="paper",
 
65
 
66
  feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
67
  feature_order = feature_order[-min(max_display, len(feature_order)):]
68
+ text = [df_shap.index[i] for i in df_shap.index]
69
  text = iter(text)
70
 
71
  for i in range(1, len(plotly_fig['data']), 2):
72
  t = text.__next__()
73
  plotly_fig['data'][i]['name'] = ''
74
+ plotly_fig['data'][i]['text'] = t
75
  plotly_fig['data'][i]['hoverinfo'] = 'text'
76
+ #plotly_fig['data'][i]['text'] = df_shap.index
77
+ plotly_fig['data'][i]['y'] = feature_names[feature_order]
 
78
 
79
 
80
  colorbar_trace = go.Scatter(x=[None],
 
103
  x=1.18,
104
  align="right",
105
  valign="top",
106
+ text='Gene',
107
  showarrow=False,
108
  xref="paper",
109
  yref="paper",