interactive matplotlib through eclipse

拈花ヽ惹草 提交于 2019-12-07 18:56:50

问题


is it possible to have an interactive session through pydev for using matplotlib? The problem is that I cannot get shell access to drive the charts as the interpretor halts after the show() command. I would like to have an interactive session through pydev.

Interactive sessions are well described by the matplotlib manual here: http://matplotlib.sourceforge.net/users/shell.html

However, no example is provided for doing this is eclipse.


回答1:


I've not used pydev much, but IIRC you can change which interactive interpreter you use. If that's possible, install ipython and use it in pylab mode (ipython --pylab from the command line)

Turns out you can't change the interpreter. You can run interpreter commands so maybe it's possible to run an ipython shell that way, but it would be easier to just launch ipython --pylab from a terminal and run it along side your eclipse session.

HTH




回答2:


Or just launch ipython from a terminal and run it along side your eclipse session.

You can also use a plugin WickedShell.




回答3:


For a quick solution, use ginput(1) to run the event event loop until you click once on the graph. It will keep the plot visible long enough to do a quick preview.

plot([2,3,4], [4,9,16])
ginput(1) # view results of plot fn
xlabel('x')
ylabel('f(x)')
ginput(1) # view results of xlabel and ylabel fns



回答4:


I guess that the problem is that the toolkit you use needs to run its event loop, and it is probably not compatible with running under Eclipse. You could try using the Agg backend, saving your figures and opening them in a separate viewer.

There's something called ezplot for plotting in another process via RPC: That would solve the event-loop problem nicely, but it seems that it is not up to date.



来源:https://stackoverflow.com/questions/3918889/interactive-matplotlib-through-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!