Hi,
I would like to plot csv data (where one column such as ‘X’ has shape (102791,)), leaning on https://plot.ly/python/user-guide/,
df = pd.read_csv(‘file.csv’)
x=df[‘X’]
y=df[‘Y’]
I guess that the length of X is too large so I’d like to plot only, say the 10 first elements.
In order to do this and to avoid problems with ‘dictionary format’ I create arrays
a = np.array([ i for i in range(10)]) instead of x (since the latter has a wronh format (time)), and
A = np.array([ y[i] for i in range(10)])
The printed values of these arrays are:
a = [0 1 2 3 4 5 6 7 8 9]
A = [ 252.62563 252.112328 252.966952 252.283861 252.865349 252.182848
251.283296 250.153394 252.018362 251.242277]
Then I try to plot these values using
import numpy as np
import pandas as pd
import csv
import plotly.plotly as py
import plotly.graph_objs as go
trace1 = go.Scatter(a[:],A[:], marker={‘color’: ‘red’, ‘symbol’: 104, ‘size’: “10”},
mode=“markers+lines”, text=[“one”], name=‘1st Trace’)
data=go.Data([trace1])
py.iplot(data, filename=‘simple-plot-from-csv’)
And no matter what I try get constantly the following error:
Traceback (most recent call last):
File “first.py”, line 119, in
mode=“markers+lines”, text=[“one”], name=‘1st Trace’)
File “/home/opt-user/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.py”, line 373, in init
d = {key: val for key, val in dict(*args, **kwargs).items()}
TypeError: dict expected at most 1 arguments, got 2
I would be most grateful for help.
Thank you!