Dear all,

I am trying the materials of an online spark course in edX (
https://www.edx.org/course/introduction-big-data-apache-spark-uc-berkeleyx-cs100-1x).
They use the ipython notebook to teach, and I want to test if zeppelin is
as good as ipython notebook when using pyspark.

However, the matplotlib does not work so far. The script and error message
are:

```
%pyspark
# Check matplotlib plotting
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from math import log

# function for generating plot layout
def preparePlot(xticks, yticks, figsize=(10.5, 6), hideLabels=False,
gridColor='#999999', gridWidth=1.0):
    plt.close()
    fig, ax = plt.subplots(figsize=figsize, facecolor='white',
edgecolor='white')
    ax.axes.tick_params(labelcolor='#999999', labelsize='10')
    for axis, ticks in [(ax.get_xaxis(), xticks), (ax.get_yaxis(), yticks)]:
        axis.set_ticks_position('none')
        axis.set_ticks(ticks)
        axis.label.set_color('#999999')
        if hideLabels: axis.set_ticklabels([])
    plt.grid(color=gridColor, linewidth=gridWidth, linestyle='-')
    map(lambda position: ax.spines[position].set_visible(False), ['bottom',
'top', 'left', 'right'])
    return fig, ax

# generate layout and plot data
x = range(1, 50)
y = [log(x1 ** 2) for x1 in x]
fig, ax = preparePlot(range(5, 60, 10), range(0, 12, 1))
plt.scatter(x, y, s=14**2, c='#d6ebf2', edgecolors='#8cbfd0', alpha=0.75)
ax.set_xlabel(r'$range(1, 50)$'), ax.set_ylabel(r'$\log_e(x^2)$')
pass
```

(<class '_tkinter.TclError'>, TclError('no display name and no $DISPLAY
environment variable',), <traceback object at 0x7fce51a925f0>)

Is there any work around to use matplotlib in zeppelin so far? Or should I
open an issue?

Best,
Wush

Reply via email to