Using Plotly to plot data from Postgre SQL database

Hello all,

I’m trying to plot a graph with time in Xaxis and Power( from my smart meter) in Yaxis.
time is in TEXT format ( Sat Jul 9 21:34:04 2016) and Power is in Float format (20.56)

i read these from the database and save it to an array
trace = py.Scatter(x=time,y=power)

and they use plotly offline to plot the graph


I get an error saying
" Invalid ‘figure_or_data’ argument. Plotly will not be able to properly parse the resulting JSON. If you want to send this ‘figure_or_data’ to Plotly anyways (not recommended), you can set ‘validate=False’ as a plot option.
Here is why you’re seeing this error:

Path to Error: ['y']

Valid attributes for 'figure' at path[] under parents[]:

['layout', 'data']

What is the error in the program?
I could plot by manually giving X and Y values.
Is it because of wrong time format?

Hi there,
It looks like you may be skipping the step of creating the data array.
So you could try:
trace = py.Scatter(x=time,y=power)
data = [trace]


trace = py.Scatter(x=time,y=power)

You can find more information on the python getting started page: //