Plotly html rendering issues

Hi All,

I’m pretty new to plotly so forgive me in advanced for the basic nature of some of my questions.

I’m attempting to use plotly to plot some pretty basic signal data. Unfortunately, it’s not working out quite as the examples seem to indicate that it would.

Here’s the code that I’m running:


import pandas as pd

import plotly.graph_objects as go

db = pd.read_csv('DCS2_3.csv');

ESC1_1 = db["ESC1-1"];
ESC_S1 = db["ESC S1"];

ts = db["Timestamp"]

fig = go.Figure()

fig.add_trace(go.Scatter(x=ts, y=ESC1_1, name='ESC1_1', line=dict(color='firebrick', width=4)))

fig.add_trace(go.Scatter(x=ts, y=ESC_S1, name='ESC1 Signal', line=dict(color='firebrick', width=4)))

fig.write_html("DSC2_3.html")

fig.show()

Whenever I try to open the html file in any browser, the browser either throws an error, or I simply get a blank screen.

When I comment out one of the fig.add_trace lines:

import pandas as pd

import plotly.graph_objects as go

db = pd.read_csv('DCS2_3.csv');

ESC1_1 = db["ESC1-1"];
ESC_S1 = db["ESC S1"];

ts = db["Timestamp"]

fig = go.Figure()

#fig.add_trace(go.Scatter(x=ts, y=ESC1_1, name='ESC1_1', line=dict(color='firebrick', width=4)))

fig.add_trace(go.Scatter(x=ts, y=ESC_S1, name='ESC1 Signal', line=dict(color='firebrick', width=4)))

fig.write_html("DSC2_3.html")

fig.show()

The figure displays, but without the legend. I feel like there is something very basic that I’m doing wrong. I’ve attached an example of what one of my ‘working’ plots looks like.

Any and all tips/pointers will be very much appreciated!