Created
December 20, 2017 20:31
-
-
Save myazdani/7788defc1f132d518df6ab0d1aa3ed66 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10 | |
| import plotly.graph_objs as go | |
| import plotly.graph_objs as go | |
| import plotly.offline as offline | |
| from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot | |
| offline.init_notebook_mode() | |
| def plotly_2d_scatter(x_data, y_data, labels = None, xlabel = "x", ylabel = "y"): | |
| trace = go.Scattergl( | |
| x = x_data, | |
| y = y_data, | |
| text = labels, | |
| mode = 'markers', | |
| marker = dict( | |
| color = '#FFBAD2', | |
| line = dict(width = 1) | |
| ) | |
| ) | |
| data = [trace] | |
| layout = go.Layout( | |
| scene = dict( | |
| xaxis = dict( | |
| title=xlabel), | |
| yaxis = dict( | |
| title=ylabel),), | |
| width=700, | |
| margin=dict( | |
| l=-50, | |
| r=0, | |
| b=0, | |
| t=0) | |
| ) | |
| fig = go.Figure(data=data, layout=layout) | |
| return fig | |
| import numpy as np | |
| N = 100000 | |
| sample_fig = plotly_2d_scatter(x_data = np.random.randn(N), y_data = np.random.randn(N), | |
| labels = None, xlabel = "x-axis", ylabel = "y-axis") | |
| iplot(sample_fig, filename='temp') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment