Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plotly Error
#1
Hello,
I am trying to smooth my data by getting some help online. I have created a code to filter data, but I believe since it is website based code, I am not able to see plots. How can I get output? The code and error;

"PlotlyError: Because you didn't supply a 'file_id' in the call, we're assuming you're trying to snag a figure from a url. You supplied the url, '', we expected it to start with 'https://plot.ly'.
Run help on this function for more information."

import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np
import pandas as pd
import scipy
from scipy import signal

outputFile=r'C:\Users\muhsi\Desktop\data'
directory=outputFile+'\\data.txt'
frequency=[]
amplitude=[]

filz=open(directory,'r')
while True:
    text = filz.readline()
    if text == '':
        break
    text = text.split()
    frequency.append(text[0])
    amplitude.append(text[1])
filz.close()

trace1 = go.Scatter(
    x=frequency,
    y=amplitude,
    mode='markers',
    marker=dict(
        size=2,
        color='rgb(0, 0, 0)',
    ),
    name='Sine'
)

trace2 = go.Scatter(
    x=frequency,
    y=signal.savgol_filter(amplitude, 53, 3),
    mode='markers',
    marker=dict(
        size=6,
        color='#C190F0',
        symbol='triangle'
    ),
    name='Savitzky-Golay'
)

layout = go.Layout(
    showlegend=True
)

data = [trace1, trace2]
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='smoothing-savitzky-golay-filter')
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020