9

The thing preventing me from switching to cloud9 is the lack of support for matplotlib since graphing things are very important to my work.

I have tried installing matplotlib but there seems to be some problems with pygtk even though it appears to be installed. Is it even possible for an online ide to interact with gtk windows on my local computer? Perhaps the graphs could be generated remotely and saved to my directory?

It would be great if anyone had successfully managed this could show me how?

4

2 回答 2

6

您可以更改后端

import matplotlib
matplotlib.use('Agg')

然后使用保存图形figure.savefig('filename')

于 2013-05-29T18:40:43.793 回答
6

正如 David Adler 所指出的,您可以设置非 GUI 后端:

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # Do not do this prior to calling use()

您可以按照通常的方式创建图形,除了保存它:

fig, ax = plt.subplots(1, 1)
ax.hist(numpy.random.randn(1000))
fig.savefig('display.svg') # Any filename will do

在 Cloud9 中,您可以在预览选项卡中打开 SVG。每次更新和保存图窗时,请刷新预览选项卡。

于 2015-11-22T15:20:02.693 回答