I’ve been using plotly in a jupyter notebook without issue, in particular for the use of KDE and histograms using the FigureFactory.
Today I’m porting all this to Dash (which is awesome BTW!).
However, I get this error message when trying to use create_distplot
:
ImportError: FigureFactory.create_distplot requires scipy
My code (summarised):
@app.callback(
Output("graph_kde", "figure"),
[
Input("table_comparisons", "selected_row_ids"),
Input("table_outputs", "selected_row_ids")
]
)
def update_graph_kde(comparison_names, output_ids):
figure = graph_helpers.get_figure_basic()
if comparison_names and output_ids and len(comparison_names) > 0 and len(output_ids) > 0:
data = data_helpers.get_graph_framescore_data(manifest_helper, comparison_names[0], output_ids)
figure = get_figure_kde(comparison_names[0], data)
return figure
def get_figure_kde(comparison_name, data):
fig = get_figure_basic()
if data:
fig = ff.create_distplot(
hist_data=[r['df']['vmaf'] for r in data],
group_labels=[r['name'] for r in data],
curve_type='kde',
bin_size=.25
)
fig.layout.title = "Histogram, Probability Density and Rug plot, for VMAF score"
fig.layout.xaxis.title = "VMAF Score"
return fig
I pip install
ed scipy, but no luck.
I seem to have solved by doing an import scipy
at the top of my file, but that’s weird since it’s not explicitly used in the code…
Am I doing anything wrong?