Matplotlib: display plot on a remote machine

后端 未结 8 1506
天涯浪人
天涯浪人 2020-11-28 19:45

I have a python code doing some calculation on a remote machine, named A. I connect on A via ssh from a machine named B. Is there a way to display the figure on

8条回答
  •  渐次进展
    2020-11-28 20:23

    GTK seems impossible to get working on Ubuntu with Python3. Instead, I used tkagg (from this answer):

    import matplotlib
    matplotlib.use('tkagg')
    import matplotlib.pyplot as plt
    

    Test that it's working with this:

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

提交回复
热议问题