import plotly.express as px ys = [] xs = [] with open("data.txt") as file: for line in file.readlines(): print(line) try: y, x = map(float, line.split(" ")) except Exception as e: print(e) ys.append(y) xs.append(x) fig = px.scatter( x=xs, y=ys, labels=dict( x="connected at (s)", y="connection number", ), ) fig.show()