Skip to content

Instantly share code, notes, and snippets.

@thehapax
Last active June 16, 2019 00:48
Show Gist options
  • Save thehapax/5d9b77bd157ee2cb04ffd09f470ed49c to your computer and use it in GitHub Desktop.
Save thehapax/5d9b77bd157ee2cb04ffd09f470ed49c to your computer and use it in GitHub Desktop.
How to turn on data privacy in plotly
import pandas as pd
from datetime import datetime
from plotly.offline import download_plotlyjs, plot
# dash apps will use go from plotly.graph_objs for displaying charts.
import plotly.graph_objs as go
# preserve privacy!
import plotly.tools
plotly.tools.set_config_file(world_readable=False, sharing='private')
# end preserve privacy
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
trace = go.Candlestick(x=df['Date'],
open=df['AAPL.Open'],
high=df['AAPL.High'],
low=df['AAPL.Low'],
close=df['AAPL.Close'])
data = [trace]
plot(data, filename='charts/simple_candlestick.html')
# dash integration example here:
# https://github.com/thehapax/plotly-template/blob/master/dash-candlestick.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment