Skip to content

Commit

Permalink
Fix plotting confidence bands with gaps (#364)
Browse files Browse the repository at this point in the history
Plotly doesn't correctly handle fills with gaps. This is an issue for
confidence bands as they are being plotted currently. Work around is to
tell Plotly to fill the gaps, which causes correct rendering.
Unfortunately it does fill the gap, but this is the easiest work around
for now.

See plotly/plotly.js#2736 for context.
  • Loading branch information
michael-nml authored Feb 16, 2024
1 parent 3e292ac commit 91f98dc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nannyml/plots/components/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def add_confidence_band(
line=dict(shape='hv', color='rgba(0,0,0,0)'),
hoverinfo='skip',
showlegend=False,
connectgaps=True,
**kwargs,
),
**subplot_args,
Expand All @@ -196,6 +197,7 @@ def add_confidence_band(
fillcolor='rgba{}'.format(matplotlib.colors.to_rgba(matplotlib.colors.to_rgb(color), alpha=0.2)),
hoverinfo='skip',
showlegend=show_in_legend,
connectgaps=True,
**kwargs,
),
**subplot_args,
Expand Down

0 comments on commit 91f98dc

Please sign in to comment.