Unexpected, strange horizontal lines through line graph

I am seeing some horizontal fragmentation in my graphs and I am wondering what is the source of it, my code or the data. At first I thought it was dates out of order but even with the dates column converted to a time series dataframe and sorted by date the graphs look exactly the same suggesting that the dates were never out of order. Has anyone seen this before? it is affecting all of my graphs.

My code:

import Data as d

import plotly

import chart_studio.plotly as py

import plotly.graph_objs as go

import chart_studio

import plotly.io as pio

from outliers import smirnov_grubbs as grubbs

data_var = d.Data()

trace1 = go.Scatter(

x=data_var.get_julian_date(),

y=grubbs.test(data_var.get_Ar(), alpha=0.99),

xaxis='x1',

yaxis='y1',

marker=go.scatter.Marker(

    color='rgb(26, 118, 255)'

),

line_shape='spline',

line_smoothing = 1.3,

)

data = [trace1]

layout = go.Layout(

plot_bgcolor='#f6f7f8',

paper_bgcolor='#f6f7f8',

title=go.layout.Title(

    text=data_var.Ar,

    xref='paper',

    font=dict(

        family='Open Sans, sans-serif',

        size=22,

        color='#000000'

    )

),

xaxis=go.layout.XAxis(

    title=go.layout.xaxis.Title(

        text='Julian Date',

        font=dict(

            family='Open Sans, sans-serif',

            size=18,

            color='#000000'

        )

    )

),

yaxis=go.layout.YAxis(

    showexponent='all',

    exponentformat='e',

    title=go.layout.yaxis.Title(

        text='Ar',

        font=dict(

            family='Open Sans, sans-serif',

            size=18,

            color='#000000'

        )

    )

)

)

fig = go.Figure(data=data, layout=layout)

#py.plot(fig, filename=β€˜Ar’)

pio.write_html(fig, file=β€˜Ar.html’, auto_open=True)

It definitely seems like some of your dates are out of order… can you share some sample data?

I am seeing similar strange behavior.

My code is:

var forec_trace = { 
               x: year_forec_arr,
               y : pop_forec_arr,
			   mode : 'lines+markers'
			};

var forec_layout = {
		title: "Population Projections 2010 to 2050, " + ctyName ,
		  autosize: false,
		  width: 1000,
		  height: 400,
		  xaxis: {
			title : 'Year',
			showgrid: true,
			zeroline: true,
			showline: true,
			mirror: 'ticks',
			gridcolor: '#bdbdbd',
			gridwidth: 2,
			linecolor: 'black',
			linewidth: 2
		  },
		  yaxis: {
			title : 'Total Population',
			automargin: true,
			showgrid: true,
			showline: true,
			mirror: 'ticks',
			gridcolor: '#bdbdbd',
			gridwidth: 2,
			linecolor: 'black',
			linewidth: 2,
			 tickformat: ','
		  },
			annotations : [{text :  'Data and Visualization by the Colorado State Demography Office.  Print Date: ' +  fmt_date(new Date) , 
               xref : 'paper', 
			   x : 0, 
			   yref : 'paper', 
			   y : -0.35, 
			   align : 'left', 
			   showarrow : false}]
		};

The underlying data is:


0: {year: 2010, totalpopulation: 604879}
1: {year: 2011, totalpopulation: 620228}
2: {year: 2012, totalpopulation: 632922}
3: {year: 2013, totalpopulation: 645303}
4: {year: 2014, totalpopulation: 658632}
5: {year: 2015, totalpopulation: 675533}
6: {year: 2016, totalpopulation: 686469}
7: {year: 2017, totalpopulation: 693135}
8: {year: 2018, totalpopulation: 702680}
9: {year: 2019, totalpopulation: 710137}
10: {year: 2021, totalpopulation: 725107}
11: {year: 2022, totalpopulation: 733279}
12: {year: 2023, totalpopulation: 743932}
13: {year: 2024, totalpopulation: 752764}
14: {year: 2025, totalpopulation: 761529}
15: {year: 2026, totalpopulation: 769878}
16: {year: 2027, totalpopulation: 778168}
17: {year: 2028, totalpopulation: 786361}
18: {year: 2029, totalpopulation: 794411}
19: {year: 2030, totalpopulation: 802309}
20: {year: 2031, totalpopulation: 810045}
21: {year: 2032, totalpopulation: 817349}
22: {year: 2033, totalpopulation: 824162}
23: {year: 2034, totalpopulation: 830557}
24: {year: 2035, totalpopulation: 836496}
25: {year: 2036, totalpopulation: 842003}
26: {year: 2037, totalpopulation: 847040}
27: {year: 2038, totalpopulation: 851628}
28: {year: 2039, totalpopulation: 855784}
29: {year: 2040, totalpopulation: 859004}
30: {year: 2041, totalpopulation: 861303}
31: {year: 2042, totalpopulation: 862412}
32: {year: 2043, totalpopulation: 862312}
33: {year: 2044, totalpopulation: 860995}
34: {year: 2045, totalpopulation: 859564}
35: {year: 2046, totalpopulation: 858041}
36: {year: 2047, totalpopulation: 856478}
37: {year: 2048, totalpopulation: 854896}
38: {year: 2049, totalpopulation: 853304}
39: {year: 2050, totalpopulation: 850636}
40: {year: 2020, totalpopulation: 717627}

Need to suppress this stray line.
TIA
AB

Hi @abick

if you look at the underlying data you posted, the last item is out of order:

image