Skip to content

Commit

Permalink
[fix] Unregister plotly resampler directly after usage (#1277)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonieFreisinger authored Apr 18, 2023
1 parent 3122da9 commit 19f6de4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions neuralprophet/plot_forecast_plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def plot(
**layout_args,
)
fig = go.Figure(data=data, layout=layout)
unregister_plotly_resampler()
return fig


Expand Down Expand Up @@ -337,6 +338,7 @@ def plot_components(
# Reset multiplicative axes labels after tight_layout adjustment
for ax in multiplicative_axes:
ax = set_y_as_percent(ax)
unregister_plotly_resampler()
return fig


Expand Down Expand Up @@ -814,6 +816,7 @@ def plot_nonconformity_scores(scores, alpha, q, method, resampler_active=False):
line_color="red",
)
fig.update_layout(margin=dict(l=70, r=70, t=60, b=50))
unregister_plotly_resampler()
return fig


Expand Down Expand Up @@ -873,4 +876,5 @@ def plot_interval_width_per_timestep(q_hats, method, resampler_active=False):
height=400,
)
fig.update_layout(margin=dict(l=70, r=70, t=60, b=50))
unregister_plotly_resampler()
return fig
2 changes: 1 addition & 1 deletion neuralprophet/plot_model_parameters_plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,5 +955,5 @@ def plot_parameters(
yaxis.update(**yaxis_args)
for trace in trace_object["traces"]:
fig.add_trace(trace, row=i + 1, col=1) # adapt var name to plotly-resampler

unregister_plotly_resampler()
return fig

0 comments on commit 19f6de4

Please sign in to comment.