How to point to graph can create a text file or csv file for feature

i use example to create graph with below

  1. but it did not show line graph

  2. how to point to graph can create a text file or csv file for feature, after point the data in graph, it
    create a vertical line in graph and mark 1 in data ,

for example 100 data , third extra column [0…0] 100 zero intially , after point the second column one of data
it change one of zero in the array of 100 zeros corresponding to the position of x axis

import plotly.plotly as py
import plotly.graph_objs as go
import plotly
import numpy as np
import pandas as pd
import plotly.figure_factory as FF
import plotly.graph_objs as go

df = pd.read_csv(‘hello.csv’)

sample_data_table = FF.create_table(df.head())

fig = go.FigureWidget([go.Scatter(x = df[‘Date’], y = df[‘Close’], mode=‘markers’)])

scatter = fig.data[0]
fig.layout.hovermode = ‘closest’

def update_point(trace, points, selector):
c = list(scatter.marker.color)
s = list(scatter.marker.size)
for i in points.point_inds:
c[i] = ‘#bae2be’
s[i] = 20
scatter.marker.color = c
scatter.marker.size = s

scatter.on_click(update_point)

#trace = go.Scatter(x = df[‘Date’], y = df[‘Close’], mode=‘markers’)
#data = [trace]
py.iplot(fig, filename = ‘basic-line’, auto_open=True)

Hi @martinlee,

I’m not sure I understand your question, but here are a few notes.

  1. Could you include some example data so that the code can run for other people? For example:
# df = pd.read_csv(‘hello.csv’)
df = pd.DataFrame({'column1': [...], ...})
  1. Please format your code in a fenced code block (See https://help.github.com/articles/creating-and-highlighting-code-blocks/)

  2. In order to use callbacks like on_click, you should not display the figure with iplot. Instead, let the figure display itself by making fig the last expression in the cell.

...
# py.iplot(fig, filename = ‘basic-line’, auto_open=True)
fig

-Jon

I use fig at final line

It only display Json like string,

But not diagram

My data is just yahoo finance data

Not for other people, for myself to create feature data easily , sometimes feel statistics can not mark feature ideally completely and exactly though have not tried.

Regards,

Ho Yeung, Lee

Martak

Hi @martinlee,

In order to have the FigureWidget display as a plot there are some extra dependencies needed. See https://github.com/plotly/plotly.py#installation and follow instructions for the Jupyter Notebook or JupyterLab (depending on which one you are using).

Hope that helps!
-Jon