Home Application – MatPlotLib – 2D & 3D Plots for MeeGo Harmattan

Application – MatPlotLib – 2D & 3D Plots for MeeGo Harmattan

MatPlotLib is a Python library for making 2D and 3D plots, usually using NumPy to calculate the data. See the MatPlotLib gallery to have an idea of which plots can be make using a Nokia N9/N950.
MatPlotLib 1.0.0 (30/07/2010) package is now released to MeeGo 1.2 Harmattan, with 3 installation files :
MatPlotLib
MatPlotLib-Data
MatPlotLib-Doc (examples)
I am just the maintainer of MatPlotLib 1.0.0 for MeeGo 1.2 Harmattan and it is based on the Maemo 5 version of Simon Pickering.
Some graphics produced by using MatPlotLib on a Nokia N9. Download the .py (Python) script and using Terminal type in the the same directory the commands after the “$” :
2D plot of a function (sin) of one variable (takes 2.9 s).
$ python simple_plot.py

3D surface plot of a function of two variables (takes 10.1 s) :
$ python surface3d_demo.py

2D vector field plot (takes 2.8 s):
$ python convfield.py

Installing MatPlotLib on MeeGo Harmattan :
Download to your Nokia N9/N950 the deb packages :
python-matplotlib_1.0.0-1_armel.deb
python-matplotlib-data_1.0.0-1_all.deb
Open the Terminal, type :
$ devel-su
and the ‘rootme’ password, then type in the same directory where the above .deb was downloaded :
# cd ~user
# apt-get install python-central python-numpy
# apt-get install python-dateutil python-gobject python-cairo
# dpkg -i python-matplotlib-data_1.0.0-1_all.deb
# dpkg -i python-matplotlib_1.0.0-1_armel.deb
confirming the installation. The dependencies and packages above take almost 40 MB after install.
Then it is important to config the backend of MatPlotLib. Still as root :
# mkdir /usr/lib/python2.6/dist-packages/matplotlib/mpl-data
Then type “Ctrl+D” to go back to user. Then type :
$ cd ~
$ mkdir .matplotlib
$ echo ‘datapath : /usr/share/matplotlib/mpl-data’ > .matplotlib/matplotlibrc
Using MatPlotLib :
It is strongly suggested to also install IPython for MeeGo Harmattan, so the interactive use of MatPlotLib/NumPy becomes a lot easier.
Open the Terminal and type if IPython is installed :
$ ipython
or else :
$ python
As a simple example (just type the text after the “In [n]:” lines) :

In [1]: from pylab import *
In [2]: x = randn(10000)
In [3]: hist(x, 100)
In [4]: savefig(‘histogram.png’)
The 1st line loads NumPy and MatPlotLib. The 2nd line calculates 10 thousand random numbers using NumPy. The 3rd line makes a histogram (but it doesn’t show it). The last line saves the histogram to a PNG file ‘histogram.png’ in the current directory. To save a PDF figure, just type instead :
In [4]: savefig(‘histogram.pdf’)
Yeah, your Nokia N9 can easily create PDF files of plots !
Limitations of MatPlotLib 1.0.0 on MeeGo Harmattan :
– there is not (yet ?) an interactive backend, so ‘show()’ does not work and should be replaced by “savefig(‘plotname.png’)” (or any graphics format like png, pdf, ps, eps and svg).
So the more than one hundred source code examples (.py Python files) in :
MatPlotLib gallery
MatPlotLib screenshots
MatPlotLib examples list
can run on Nokia N9/N950 after replacing ‘show()’ by “savefig(‘plotname.png’)” (for example).
For making plots with calculations using derivatives, integrals, etc, then SymPy is also available for MeeGo Harmattan :
SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
By the way, be a N9/N950 proud user : MatPlotLib is only available for Linux, Windows, Mac OS, Maemo 5 and now MeeGo 1.2 Harmattan. Android and iOS, AFAIK, do not have MatPlotLib available.
Next steps for MatPlotLib on MeeGo Harmattan :
– show easy script examples (with documentation) to make the most useful plots (IN PROGRESS);
– release MatPlotLib packages in a public MeeGo Harmattan repository (App);
– try to release MatPlotLib 1.1.0 (06/10/2011), which includes animations, PySide compatibility (so, maybe, I say, maybe, interactive backend could run on Nokia N9/950);
– release softwares depending on MatPlotLib/Numpy with easy to use interface (in Qt Quick) to make from simple to complex plots of functions of 1 or 2 variables, of experimental data with error bars, eletrical vector field/potential, etc.
 
 
Source Maemo.Org

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the tech industry for major developments, new product launches, AI breakthroughs, video game releases and other newsworthy events. Editors assign relevant stories to staff writers or freelance contributors with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.