← Back to team overview

yade-dev team mailing list archive

Re: live plot update during simulation

 

Hi Janek, this is a great feature, I tried several times and it never
worked properly. If you notices, the first call to plot.plot() is
blocking (till you close those plots), while the next ones are not; I
suspect that this is exactly the issue.

A problem is that matplotlib has several backends (Tk, Gtk, Wx) and they
sould be all supported -- let's see. Another problem is that a a LOT of
code is duplicated, and it is code that is not easy to read and can be
buggy.

Thanks for your contribution, I will try to fix that and merge plot with
liveplot etc. so that the code is readable.

mtTkinter can be added locally to yade, no problem.

Cheers, Vaclav


> Hello,
> 
> I am learning python and there's a lot of stuff in python that I
> don't know yet. To learn a little bit more I decided to try adding a
> feature of showing live plot updates during simulation, like this:
> 
> http://geo.hmg.inpg.fr/~janek/yade-videos/yade_livePlot.mpg
> 
> https://www.yade-dem.org/wiki/Screenshots_and_videos#Experimantal_feature:_live_update_of_plotting
> 
> By doing this I am sure that I broke some clean coding python
> conventions, just because I don't know python yet ;)
> 
> And there is a very ugly trick involved, and I hope Vaclav that you
> could make this trick not ugly.
> 
> The trick is following:
> 
>   wget http://tkinter.unpythonic.net/attach//mtTkinter/attachments/mtTkinter-0.3.tar.gz
>   tar -xvzf ./mtTkinter-0.3.tar.gz
>   sudo cp ./mtTkinter.py /usr/lib/python2.6/lib-tk/mtTkinter.py
>   sudo vim /usr/lib/pymodules/python2.6/matplotlib/backends/tkagg.py
>   :%s/import Tkinter as Tk/import mtTkinter as Tk/g
>   :wq
> 
> It is the ugliest thing that I have done to my debian installation recently.
> 
> But after that? It works like a charm.
> 
> Vaclav, I am not committing this, but rather sending as attachments.
> I prefer that you will review and clean it up.
> 
> after applying those two patches you can just run uniax.py and enjoy
> live updating plot.
> 
> best regards
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp





Follow ups

References