1

I'm trying to plot some data coming from the sensor on banana pi. For simplicity of development I use python and wxWidget. To plot the data I use matplotlib library. It's doing ok on my laptop, but when I launch it on banana pi, the plot is drawn very slow.

def on_redraw_timer(self, event):
    print datetime.datetime.now()
    self.data.append(getCurrentValue())
    self.draw_plot()

This code is executed every 100 ms and this is what it outputs

2016-03-06 10:51:47.530607
2016-03-06 10:51:47.880988
2016-03-06 10:51:48.211054
2016-03-06 10:51:48.538298
2016-03-06 10:51:48.864935
2016-03-06 10:51:49.190108
2016-03-06 10:51:49.514287
2016-03-06 10:51:49.851634
2016-03-06 10:51:50.178744
2016-03-06 10:51:50.503762

So it takes 300 ms to draw the plot. Which is unacceptable. Is it possible to fasten the drawing speed? Or should I use some other libraries?

Thank you!

1 Answer 1

1

I think that there is no real way of speeding things up on the banana pi. Keep in mind that you are using a tiny CPU with a very limited amount of RAM for the same application you usually use your laptop for. I'm not saying that you cannot run a GUI on the banana pi or use matplotlib, but the 100ms replot frequency is a little bit tough, as you have already experienced on your own. Especially since you run an operating system (linux, I guess) with a window manager that takes it's toll on the RAM and CPU as well.

As a suggestion, could you use your existing python script to extract the data and use gnuplot to display it? This could work at that frequency. There is even a gnuplot python interface, but this will most likely not solve your 300ms plot delay problem.

Sign up to request clarification or add additional context in comments.

4 Comments

yeah banana-pi is tought. do you think perfomance would be better if I use C++ instead of python? and use some low level C++ libraries to draw graphs?
I would check if you can constantly visualize the data with gnuplot, while the existing python methods do the data extraction, before I spend more time on coding. Otherwise you port everything to C++ and then it's the same thing, but in C++.
Was this helpful to you?
Have a look at caswenson.com/2008_02_22_python_gnuplot_gnuplotpy, the documentation as such is pretty sparse.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.