Created
April 6, 2020 09:36
-
-
Save cereniyim/e9470f9ebeb9cda18cba02909751a35d to your computer and use it in GitHub Desktop.
explanation of how plotly works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
np.random.seed(42) | |
import plotly.offline as pyo | |
import plotly.graph_objs as go | |
# create data | |
x = np.random.randint(1, 101, 100) | |
y = np.random.randint(1, 101, 100) | |
# data object to be used in figure object | |
data = [go.Scatter( | |
x=x, | |
y=y, | |
mode='markers', | |
)] | |
# layout object to be used in figure object | |
layout = go.Layout( | |
title=’Plot title’, | |
xaxis=dict(title=’X-Axis’), | |
yaxis=dict(title=’Y-Axis’), | |
hovermode=’closest’ | |
) | |
# figure object to display the plotly chart | |
fig = go.Figure(data=data, layout=layout) | |
pyo.plot(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment