Update to the latest development version of Matplotlib-1.4.x. Install in virtualenv using
$ pip install -e git@github.com :matplotlib/matplotlib.git
Then the OP commands work on all platforms. There is also a new built-in webagg example in the main matplotlib branch on GitHub , which works on all my systems (Windows-7x64, Ubuntu-14.14 and Xubuntu-14.14).
Using the OP commands with Matplotlib-1.3.1, I get mixed results depending on the platform used. On one machine (Ubuntu-14.14), I was able to show the shape if I used sudo to execute OP commands:
$ sudo python >>> import matplotlib >>> matplotlib.use('webagg') >>> import matplotlib.pyplot as plt >>> plt.plot(range(10)) >>> plt.show()
This works both in virtualenv and in the Ubuntu matplotlib distribution.
While on the VMWare Player virtual machine (Xubuntu-14.14, hosted on Windows-7x64), I was able to show the drawing using OP commands without sudo . On the third (Windows-7x64) machine, I still canโt get the number using the OP commands with or without administrator privileges. I also changed matplotlib.rcParams['webagg.port'] to 8080 and 8000, but that also did not work.
In Ubuntu-14.14 using matplotlib installed from the distribution repository, you will see the following trace:
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_webagg.py", line 381, in get 'matplotlib.png'), 'rb') as fd: IOError: [Errno 2] No such file or directory: '/usr/lib/pymodules/python2.7/matplotlib/mpl-data/images/matplotlib.png'
This has nothing to do with why the image does not appear; this error only appears on Linux machines where the mpl-data folder is not located where matplotlib.backends.backend_webagg expects it to be, but is actually located in /usr/share/matplotlib/ . In particular, backend_webagg looking for the backend_webagg file, which it uses as the icon for the web browser tab, and in fact Tornado will still serve the page, even if it does not find this file, although, unfortunately, it still calls this a mistake.
If you use virtualenv, you will not see favicon error.
Using Matplotlib-1.3.1 without sudo on Ubuntu-14.14 and on a Windows-7x64 machine, I get the same โFigure 1โ link that @allisonmuller received in the comment above.