Ishmeet Kaur created ZEPPELIN-1428:
--------------------------------------
Summary: Improving Matplotlib integration with zeppelin Pyspark
Key: ZEPPELIN-1428
URL: https://issues.apache.org/jira/browse/ZEPPELIN-1428
Project: Zeppelin
Issue Type: Improvement
Reporter: Ishmeet Kaur
Currently plotting via matplotlib in the zeppelin notebook with the pyspark
interpreter can be done by
{code}
%pyspark
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
import StringIO
def show(p):
img = StringIO.StringIO()
p.savefig(img, format='svg')
img.seek(0)
print "%html <div style='width:600px'>" + img.buf + "</div>"
# Example data
people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')
y_pos = np.arange(len(people))
performance = 3 + 10 * np.random.rand(len(people))
error = np.random.rand(len(people))
plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4)
plt.yticks(y_pos, people)
plt.xlabel('Performance')
plt.title('How fast do you want to go today?')
show(plt)
{code}
The show() functionality for plotting thin the PyZeppelinContext class is not
present in pyspark.
Instead of defining the show() function explicitly,we need to add the
functionality of show_matplotlib() as in bootstrap.py to the z.show() function.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)