Using python and matplotlib on android

marshall picture marshall · Aug 21, 2013 · Viewed 33.4k times · Source

Is there a way to set up python 2.7.x + matplotlib on an android tablet so that you can run simple standard python code? I would like to be able to run the same scripts I run on my Linux desktop. This is just for my own use and I don't need to distribute the code to anyone else.

As a concrete example, is it possible to run this script?

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y)

Answer

RoundSparrow hilltx picture RoundSparrow hilltx · Aug 30, 2013

Is it easy, no.

Can it be done? Yes. I believe a skilled Python / Android developer could do it in 2 to 8 hours of effort.. It's a rare and complex request.

Why do I think it can be done? This sample: http://matplotlib.org/examples/pylab_examples/webapp_demo.html

Using a different library, and not abstracted for data without live hardware, this sample shows me that SL4A can do web-based graphics: http://www.smartphonedaq.com/android-python-ecg.page

Now, if you were talking native GUI graphics in Android - then I'm focused way too much on the web methods of publishing with SL4A ;)