Skip to content
Advertisement

Break line chart on the plot

I have a dataframe with a column for weeks and data captured for each week. it looks like this

JavaScript

Now I am plotting a line chart with this data . Notice that from week 23 to week 40, we didnt have data. so my intention is to skip this weeks on the plot and only have a line chart of those weeks with available data.

Plotly orders everything automatically and it includes the missing weeks and this might cause problems when its being interpreted.

see what plotly does

JavaScript

How can I have a break on the chart from week 23 to 40. Like the line chart to break in show that we didnt have data in those specific weeks.

Advertisement

Answer

First, I would re-index the data so weeks with no data are accounted for.

JavaScript

Figure

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement