Tried x = np.arange(100), x = np.linspace(-2,2,1000) with both python2 and python3 in %python interpreter. I don't have any problem.
On Wed, Sep 14, 2016 at 3:12 AM Xi Shen <davidshe...@gmail.com> wrote: > OK, for this problem, it is discussed at > https://stackoverflow.com/questions/15538099/conversion-of-unicode-minus-sign-from-matplotlib-ticklabels > > However, I just tried with Jupyter notebook, and its matplotlib can plot > with negative values on the axes correctly, and > matplotlib.rcParams['axes.unicode_minus'] = True. > > Can you guys please check if this only happens to a Python3 environment? I > don't think I am the first one hit this problem. > > > > On Wed, Sep 14, 2016 at 5:49 PM Xi Shen <davidshe...@gmail.com> wrote: > >> Hi, >> >> I worked it out...So I have start a new instance of Zeppelin...creating a >> new notebook wont take effect...So all the Python code are executed in one >> python vm? Shouldn't separating ones are better? >> >> After I get matplotlib work, I have a new problem. >> >> This code snippet works >> %python >> >> import numpy as np >> import matplotlib.pyplot as plt >> >> x = np.arange(100) >> >> plt.figure() >> plt.plot(x, x**2) >> z.show(plt, width='300px') >> plt.close() >> >> But if I change x value to x= np.linspace(-2, 2, 1000), as it it used in >> the example, I got >> >> <matplotlib.figure.Figure object at 0x7fa177d197b8> >> [<matplotlib.lines.Line2D object at 0x7fa177ecf080>] >> >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File "<stdin>", line 23, in show >> File "<stdin>", line 69, in show_matplotlib >> UnicodeEncodeError: 'ascii' codec can't encode character '\u2212' in >> position 17262: ordinal not in range(128) >> >> I did some testing, and I found if any of the value passed to plot() >> contains negative numbers, I will get this error...very odd. >> >> >> >> On Wed, Sep 14, 2016 at 8:50 AM Felix Cheung <felixcheun...@hotmail.com> >> wrote: >> >>> And >>> matplotlib.use('Agg') >>> >>> Would only work before matplotlib is first used so you would need to >>> restart the interpreter. From error stack below it looks like something >>> might be setting the default backend in matplotlib to TkAgg though. >>> >>> Are you using the Python interpreter or PySpark interpreter? Also how >>> you are calling matplotlib like Moon asks? >>> >>> _____________________________ >>> From: moon soo Lee <m...@apache.org> >>> Sent: Tuesday, September 13, 2016 2:34 PM >>> Subject: Re: Matplotlib uses tkinter instead of Agg >>> To: <users@zeppelin.apache.org> >>> >>> >>> >>> Hi, >>> >>> Thanks for sharing the problem. >>> Could you share which version of Zeppelin are you using and how did you >>> try matplotlib inside of Zeppelin? Are you trying matplotlib with >>> z.show() ? >>> >>> Thanks, >>> moon >>> >>> On Tue, Sep 13, 2016 at 1:56 AM Xi Shen <davidshe...@gmail.com> wrote: >>> >>>> Hi, >>>> >>>> I want to build a Zeppelin docker image for my self. The docker image >>>> is based on ubuntu:wily, and has openjdk-8-jre and python3 installed. I >>>> also installed other packages that I need. >>>> >>>> After started Zeppelin in the docker, I am able to access the webapp >>>> from my local browser. I tried to execute some simple Python script, and it >>>> works fine. But when I try to run the matplotlib example, I got error >>>> saying that tkinter cannot find the $DISPLAY. >>>> >>>> Traceback (most recent call last): >>>> File "<stdin>", line 1, in <module> >>>> File "/usr/local/lib/python3.4/dist-packages/matplotlib/pyplot.py", >>>> line 535, in figure >>>> **kwargs) >>>> File >>>> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_tkagg.py", >>>> line 84, in new_figure_manager >>>> return new_figure_manager_given_figure(num, figure) >>>> File >>>> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_tkagg.py", >>>> line 92, in new_figure_manager_given_figure >>>> window = Tk.Tk() >>>> File "/usr/lib/python3.4/tkinter/__init__.py", line 1859, in __init__ >>>> self.tk = _tkinter.create(screenName, baseName, className, >>>> interactive, wantobjects, useTk, sync, use) >>>> _tkinter.TclError: no display name and no $DISPLAY environment variable >>>> >>>> Some people on the Internet suggested adding matplotlib.use('Agg') at >>>> the beginning of the notebook, but it still does not work for me. >>>> >>>> -- >>>> >>>> >>>> Thanks, >>>> David S. >>>> >>> >>> >>> -- >> >> >> Thanks, >> David S. >> > -- > > > Thanks, > David S. >