View Single Post
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#2
Here are some useful examples/templates scripts for ploting with MatPlotLib/NumPy. They have many options to change : domain, function, labels, title, etc. To adapt them to your use, just open the .py file with a text editor, change the definitions in the section "# Personalize your plot parameters here", save and run (using Terminal) :
$ python <scriptname>.py
Timings for MatPlotLib 1.3.1 and NumPy 1.8.1 on Nexus 4 running Sailfish.

plotfx.py : Plot of one variable, f=f(x), saving to a (PNG) file. Takes 1.6s.


contourfxy.py : contour plot of two variables, f=f(x,y), saving to a (PNG) file. Takes 5.4s.


densityfxy.py : density shaded relief plot of two variables, f=f(x,y), saving to a (PNG) file. Takes 5.1s.


vectorfieldFxy.py : vector field plot in 2D, F=F(x,y), saving to a (PNG) file. Takes 4.3s.


surfacefxy.py : surface plot of two variables, f=f(x,y), saving to a (PNG) file. Takes 8.7s.


Comparing with the Nokia N9 results (with MatPlotLib 1.2.0 and NumPy 1.4.1 and other versions of MatPlotLib and NumPy), Sailfish on Jolla or Nexus 4 is approx. twice or more faster.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2014-06-09 at 09:19.
 

The Following User Says Thank You to rcolistete For This Useful Post: