Created
November 17, 2016 07:08
-
-
Save Orbifold/6c92e0e00a00a03fdee41edfcded8122 to your computer and use it in GitHub Desktop.
Zeppelin plotly example.
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
# if needed, install plotly via shell like so | |
%sh pip install plotly | |
#--- | |
%pyspark | |
import plotly | |
import numpy as np | |
from plotly.graph_objs import Scatter, Layout | |
def plot(plot_dic, height=500, width=1500, **kwargs): | |
kwargs['output_type'] = 'div' | |
plot_str = plotly.offline.plot(plot_dic, **kwargs) | |
print('%%angular <div style="height: %ipx; width: %spx"> %s </div>' % (height, width, plot_str)) | |
plot({ | |
"data": [ | |
Scatter(x=np.arange(1,100), y=np.random.randint(1,100,100)) | |
], | |
"layout": Layout( | |
title=Random data" | |
) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A good Zeppelin container can be found here.