发送到 X11 的 rpy 绘图突然关闭? [英] Plots made with rpy sent to X11 suddenly close?

查看:66
本文介绍了发送到 X11 的 rpy 绘图突然关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 RPy2 来绘制一些图.绘图显示,但 X11 窗口立即消失.

I'm using RPy2 to make some plots. The plot shows up but the X11 window immediately disappears.

我输入的内容如下,其中CCFS是一个数据矩阵

All I'm typing is the following, where CCFS is a data matrix

 import rpy2.robjects as robjects
 r = robjects.r

 pca = r.princomp(CCFS)
 r.plot(pca,main="Eigenvalues")
 r.biplot(pca,main="biplot")
 r['dev.off']() #*EDIT* the problem persists even if I remove this line.

我是否没有包含某些内容?我知道有一些东西要绘制,因为 princomp 返回一个不为空的 ListVector.

Am I failing to include something? I know that there is something to plot because princomp returns a ListVector that isn't null.

推荐答案

添加

input()         # for Python3
# raw_input()   # for Python2

到脚本的末尾,以防止程序在用户按下 Enter 键之前结束.

to the end of the script to prevent the program from ending until the user presses Enter.

这篇关于发送到 X11 的 rpy 绘图突然关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆