相关疑难解决方法(0)

如何使用pylab远程保存数字?

我正试图用命令在远程计算机上生成一个数字pylab.savefig.但我得到了这样的错误:

Unable to access the X Display, is $DISPLAY set properly?
Run Code Online (Sandbox Code Playgroud)

如何正确保存图形?

python matplotlib figure

71
推荐指数
1
解决办法
3万
查看次数

未定义DISPLAY时使用Matplotlib

在远程计算机上使用Matplotlib时(例如在Travis CI上),我遇到了与未设置的DISPLAY环境变量相关的频繁运行时错误.按照建议,我在测试脚本的开头设置了Agg后端matplotlib.use,并确保没有调用show().不过,我仍然会遇到以下错误:

Traceback (most recent call last):
  File "/home/travis/anaconda/envs/testenv/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/travis/build/pymc-devs/pymc/pymc/tests/test_plots.py", line 36, in test_multichain_plots
    forestplot(ptrace, vars=['early_mean', 'late_mean'])
  File "/home/travis/build/pymc-devs/pymc/pymc/plots.py", line 325, in forestplot
    interval_plot = subplot(gs[0])
  File "/home/travis/anaconda/envs/testenv/lib/python2.7/site-packages/matplotlib/pyplot.py", line 896, in subplot
    fig = gcf()
  File "/home/travis/anaconda/envs/testenv/lib/python2.7/site-packages/matplotlib/pyplot.py", line 450, in gcf
    return figure()
  File "/home/travis/anaconda/envs/testenv/lib/python2.7/site-packages/matplotlib/pyplot.py", line 423, in figure
    **kwargs)
  File "/home/travis/anaconda/envs/testenv/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 31, in new_figure_manager
    return new_figure_manager_given_figure(num, thisFig)
  File "/home/travis/anaconda/envs/testenv/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py", line 38, in new_figure_manager_given_figure
    canvas = FigureCanvasQTAgg(figure) …
Run Code Online (Sandbox Code Playgroud)

python matplotlib

34
推荐指数
1
解决办法
3万
查看次数

标签 统计

matplotlib ×2

python ×2

figure ×1