Accurately scaled x-axis intervals

Hi–have posted this on SO but want to see if the Plotly community has any thoughts.

I am reading a dataframe from a csv to plot in my Dash Plotly graph. The first column of the csv is Time in the format of, which I am using for the x-axis. However, the time intervals at which data was taken are uneven (usually differing from thousandths of a second to a full second, sometimes more). Right now, my script is just taking the data and plotting it on the x-axis evenly spaced. Is there a way to use Plotly to make my script read the time stamps “smartly” and have it plot the data with spacing between each data point proportional to the amount of time elapsed between them? (Or if it is not possible with Plotly, is it possible with another graphing library that is supported with Dash?)

I was told to convert my Time column to DateTime objects, but I’m trying it out with a really simple script and test csv and Dash is throwing an error.

import plotly.graph_objs as go
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import ntpath
from tkinter import filedialog

import_file_path = filedialog.askopenfilename()
df = pd.read_csv(import_file_path, sep='\t', low_memory = False)
fileName = ntpath.basename(import_file_path)

df['Time'] = pd.to_datetime(df['Time'])     #hardcoded, test csv has two columns Time and dat

app = dash.Dash(__name__, suppress_callback_exceptions=True)

app.layout = html.Div([
        figure = go.Scatter(x=df['Time'], y=df['dat'])

if __name__ == '__main__':

Error I get:

Did you ever get a response here? Running into this same issue with irregular x-axis data

Yes! Plotly only reads timestamps in one specific format–I can’t remember exactly but I believe it’s YYYY-MM-DD HH:MM:SS. Putting it in the correct format made it read as actual timestamp data, not just string values. If I still had access to this project I would check to verify the format but unfortunately I don’t–best of luck figuring it out.

So you ended up using Timestamps instead of Datetime?
Thank you so much!

Sorry, I don’t remember the difference between those, I was just using them interchangeably. Whatever type it is, putting it in that format makes plotly read it as actual time data and space it accurately on the x-axis.