Matplotlib: display plot on a remote machine

后端 未结 8 1505
天涯浪人
天涯浪人 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:40

    Sure, you can enable X11 forwarding. Usually this is done by passing the -X or -Y option to ssh when you connect to the remote computer

    ssh -X computerA
    

    Note that the SSH daemon on computer A will also have to be configured to enable X11 forwarding. This is done by putting

    X11Forwarding yes
    

    in computer A's sshd_config configuration file.

    If computer A's SSH daemon does not have X11 forwarding enabled, you can always have Python write the result of the calculation to a text file, download it to computer B, and use Matplotlib locally.

提交回复
热议问题