Missing line in mode = 'lines'



I am in python3 (jupyter on mac os) and I just got this weird issue, in my go.scatter plot – a piece of the line is missing

any idea on what’s going on?

Thanks for your help


connectgaps=True connects last with first data unfortunately


Paste your code and data, please. We can help you only seeing what’s wrong in your code, and data.



here is how I am building the trace:

full_trace = []

    x = my_df.temp_var,
    y = my_df.cases,
    mode = 'lines+markers',
#     connectgaps=True, ## not working properly! -- connecting last w/ first 
    name = 'VENEZUELA'


and this is the subset of the dataset close to that gap



Did you sort the dataframe by date?


thanks – sorting the df fixed the issue

(however, I don’t see why the plot should depend on the sorting of the df)


@grgr If you remember a math function, f:[a, b]-->R, is defined on an interval that is an ordered set, and to get its graph you are plotting the line passing through 2d points of coordinates (x, f(x)), with x in [a,b]. Python and other programming languages works with a discretized function, i.e. you evaluate that function at some arguments
a=x_0<x_1<....< x_n=b.
Your line is defined on a time interval, that’s why you should sort the dataframe by date.