简体   繁体   English

通过eclipse进行交互式matplotlib

[英]interactive matplotlib through eclipse

is it possible to have an interactive session through pydev for using matplotlib? 是否可以通过pydev进行交互式会话以使用matplotlib? The problem is that I cannot get shell access to drive the charts as the interpretor halts after the show() command. 问题是当解释器在show()命令后停止时,我无法通过外壳访问来驱动图表。 I would like to have an interactive session through pydev. 我想通过pydev进行互动会议。

Interactive sessions are well described by the matplotlib manual here: http://matplotlib.sourceforge.net/users/shell.html matplotlib手册在此处对交互式会话进行了很好的描述: http : //matplotlib.sourceforge.net/users/shell.html

However, no example is provided for doing this is eclipse. 但是,没有提供执行此操作的示例。

I've not used pydev much, but IIRC you can change which interactive interpreter you use. 我使用pydev的次数不多, 但是IIRC您可以更改使用的交互式解释器。 If that's possible, install ipython and use it in pylab mode (ipython --pylab from the command line) 如果可能,请安装ipython并在pylab模式下使用它(从命令行ipython --pylab)

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. 您可以运行解释器命令,以便也许可以以这种方式运行ipython shell,但ipython --pylab终端启动ipython --pylab并在日食会话中运行它会更容易。

HTH HTH

Or just launch ipython from a terminal and run it along side your eclipse session. 或者只是从终端启动ipython并在日食会话旁边运行它。

You can also use a plugin WickedShell . 您也可以使用插件WickedShell

For a quick solution, use ginput(1) to run the event event loop until you click once on the graph. 为了快速解决方案,请使用ginput(1)运行事件事件循环,直到在图形上单击一次。 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

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. 我猜是问题在于您使用的工具包需要运行其事件循环,并且可能与在Eclipse下运行不兼容。 You could try using the Agg backend, saving your figures and opening them in a separate viewer. 您可以尝试使用Agg后端,保存图形并在单独的查看器中打开它们。

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. 有一种称为ezplot的东西,可以通过RPC在另一个过程中进行绘图:可以很好地解决事件循环问题,但似乎还不是最新的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM