Plotting glitch with matplotlib [python3]? - EDITED

Viewed 48

I have some issues plotting "large" datasets of timeseries data in python, where the time jumps across a few decades in erroneous samples. We aim to visualise only the timestamp (unixtime + custom microseconds) vs index. In this example there are roughly 40k samples.

Basically, I am assuming it is some issue with the rendering of the plot by matplotlib, because when I move the axes, both the scatter points and also the lineplot seem to glitch all over the place. A further bit of evidence for this is that the line in the lineplot is not actually going through the markers, when I zoom in or pan the plot.

The timestamps are continuous and increase by 40ms between steps.

Overview of errors (timestamp is zero -> default date 1.1.1970)

Zoomed in on y axis

More zoomed in

Example of how the plot should look like

Timestamp raw data (ignore ms fraction 2)

Code used to plot (using google colab, re-created in Visual Studio Code)

  if single_file_or_multiple == "multiple":
    fig = px.line(df_trace, x=df_trace.index, y="time", markers=True,
                  color="rec_id")
    fig.show()
0 Answers
Related