Created
June 1, 2019 08:34
-
-
Save malhotrachetan/06c766c5feefd5bbfd64e3a6aa24dd11 to your computer and use it in GitHub Desktop.
Plotly on google colab/kaggle
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
def configure_plotly_browser_state(): | |
import IPython | |
display(IPython.core.display.HTML(''' | |
<script src="/static/components/requirejs/require.js"></script> | |
<script> | |
requirejs.config({ | |
paths: { | |
base: '/static/base', | |
plotly: 'https://cdn.plot.ly/plotly-1.5.1.min.js?noext', | |
}, | |
}); | |
</script> | |
''')) |
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
import plotly.plotly as py | |
import numpy as np | |
from plotly.offline import init_notebook_mode, iplot | |
from plotly.graph_objs import Contours, Histogram2dContour, Marker, Scatter | |
configure_plotly_browser_state() | |
init_notebook_mode(connected=False) | |
x = np.random.randn(2000) | |
y = np.random.randn(2000) | |
iplot([Histogram2dContour(x=x, y=y, contours=Contours(coloring='heatmap')), | |
Scatter(x=x, y=y, mode='markers', marker=Marker(color='white', size=3, opacity=0.3))], show_link=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment