Enzo Mar created ZEPPELIN-709:
---------------------------------

             Summary: regression: graphics working with spark (pyspark) on 
python 2.7 does not work with 3.x 
                 Key: ZEPPELIN-709
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-709
             Project: Zeppelin
          Issue Type: Bug
          Components: zeppelin-interpreter
    Affects Versions: 0.5.6, 0.5.5, 0.6.0
            Reporter: Enzo Mar


I refer to the notorious notebook "Visualizations In Zeppelin".

The following code, modified for python 3 and working correctly on jupyter 
(adding %matplotlib infield), does not work anymore:


from pylab import figure, show, rand
from matplotlib.patches import Ellipse
import matplotlib.pyplot as plt


# helper function to display in Zeppelin
import io
def show(p):
    img = io.StringIO()
    p.savefig(img, format='svg')
    img.seek(0)
    img.read()
    print ("%html <div style='width:600px'>" + img.read() + "</div>") 

NUM = 250
plt.clf()
ells = [Ellipse(xy=rand(2)*10, width=rand(), height=rand(), angle=rand()*360)
        for i in range(NUM)]

fig = figure()
ax = fig.add_subplot(111, aspect='equal')
for e in ells:
    ax.add_artist(e)
    e.set_clip_box(ax.bbox)
    e.set_alpha(rand())
    e.set_facecolor(rand(3))

ax.set_xlim(0, 10)
ax.set_ylim(0, 10)
show(plt)

Nothing is displayed....



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to