使用X11转发时的pyplot

使用X11转发时的pyplot

本文介绍了使用X11转发时的pyplot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置远程工作环境,以便可以在ipython下使用matplotlib.pyplot.我的本地计算机和远程计算机都是MAC OSX Mavericks.我已经尝试过xeyes并且它可以正常工作,所以我认为X11转发可以正常工作.但是,当我尝试matplotlib.pyplot中的函数时,它没有显示任何错误消息,但也没有看到任何数字.

I'm trying to setup my remote working environment so that I can use matplotlib.pyplot under ipython. My local machine and remote machine are both MAC OSX Mavericks. I've tried xeyes and it works properly so I think my X11 forwarding works fine. However, when I try functions in matplotlib.pyplot it didn't show any error message but I didn't see any figure either.

我知道它与要使用的后端有关,我已经尝试使用ipython --pylab=tk,但是没有用.试图安装pygtk,但无法安装依赖项py2cairo(似乎是未解决的问题).还有其他想法吗?谢谢.

I know it's about which backend to use and I've tried using ipython --pylab=tk but didn't work. Tried to install pygtk but can't manage to install a dependency py2cairo (seems to be an open issue). Any other thoughts? Thanks.

推荐答案

您如何尝试在matplotlib.pyplot中使用函数"?

How did you "try functions in matplotlib.pyplot"?

以下对我有用的

import matplotlib
matplotlib.use('tkagg')
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.show()

这篇关于使用X11转发时的pyplot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 22:37