Running Pyplot over Putty ssh from windows machine to linux

9,230

As described by this question and this question, you can configure pyplot to not try to use the display:

import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
Share:
9,230

Related videos on Youtube

Chris
Author by

Chris

Updated on September 18, 2022

Comments

  • Chris
    Chris over 1 year

    I am running python code on a linux machine through a putty ssh from a windows machine.

    I need to run the following commands:

    dataframe.plot()
    matplotlib.pylot.savfig("some figure.png")
    

    Nothing actually gets displayed, but the python code apparently checks to see that the display variable is set. Anyhow, the display variable is invalid and has nowhere to go.

    I did what I usually do when ssh'ing from a linux box:

    export DISPLAY=:0.0
    

    But then I ran into an issue with the X-server. So I enabled X11 forwarding through putty.

    Then, I ran into the issue that there is no X-server on Windows...

    Is there a way I can just bypass this and get the data to save?

    (or I guess set up an X-server and redirect the display) (Have installed Xming, and am running it...but that is as far as I've gotten...I still haven't managed to export the display to the X server...)

    • MariusMatutiae
      MariusMatutiae over 8 years
      Have you considered running a VNC server on the Linux machine, and a VNC client on the Windows machine? This, linuxtopia.org/HowToGuides/VNC_setup_Linux_Windows.html is a very nice and complete summary of ll the steps necessary. Remember you can even launch a whole copy of your Linux desktop environment (Gnome, KDE, whatever....) to be displayed on your Windows pc.
    • Chris
      Chris over 8 years
      awesome. I will set that up. I just need to graph about 4hrs worth of high performance processing before midnight (when the assignment is due)...
  • Chris
    Chris over 8 years
    Got it. at least that will work for now. Thank you.