Filled area plots with na in between points not working as expected

Hi,

I am trying to do a filled area plot for which the traces has np.nan data. However, when np.nan data exist in the Y-axis of the trace the filling does not work as expected, i.e., It does not do the filling to the next Y trace anymore even though I am using the option fill=‘tonexty’.

Example without NAs work great:

trace1=go.Scatter(
x=[‘W01’,‘W02’,‘W03’,‘W04’,‘W05’,‘W06’],
y=[1.5,1.6,1.8,1.2,2,2.4],
name=‘high’,
fill=None,
mode=‘lines’
)
trace2=go.Scatter(
x=[‘W01’,‘W02’,‘W03’,‘W04’,‘W05’,‘W06’],
y=[1.4,1.3,1.2,0.9,2,2.1],
name=‘low’,
fill=‘tonexty’,
mode=‘lines’
)

data=[trace1, trace2]

fig = go.Figure(data=data)
import plotly
plotly.offline.plot(figure_or_data=fig, filename=’/mnt/efs/downloads/tmp/test.html’)

Example with NAs with the filling tonexty not working:

trace1=go.Scatter(
x=['W01','W02','W03','W04','W05','W06'],
y=[1.5,1.6,1.8,np.nan,2,2.4],
name='high',
fill=None,
mode='lines'

)
trace2=go.Scatter(
x=[‘W01’,‘W02’,‘W03’,‘W04’,‘W05’,‘W06’],
y=[1.4,1.3,1.2,np.nan,2,2.1],
name=‘low’,
fill=‘tonexty’,
mode=‘lines’
)

data=[trace1, trace2]

fig = go.Figure(data=data)
import plotly
plotly.offline.plot(figure_or_data=fig, filename=’/mnt/efs/downloads/tmp/test_na.html’)

Hi @dnaiel,

This looks like a bug to me. I opened an issue with the plotly.js project at https://github.com/plotly/plotly.js/issues/3296. Please follow along over there.

Thanks!
-Jon