How to plot figures on remote server?

dw
3 min readApr 22, 2021

The information below is from the following websites. The purpose here is only for personal notes taking.

The X Window System (commonly X or X11) is a computer software system and network protocol that provides a graphical user interface (GUI) for networked computers. It creates a hardware abstraction layer where software is written to use a generalized set of commands, allowing for device independence and reuse of programs on any computer that implements X.

Since Windows does not support X11 based windowing natively, it is necessary to run a special program called an “X Server” that allows your Windows desktop to do so. The Computing and Networking Infrastructure (CNI) group currently recommends a free X server software, Xming. Since X-windows does not provide secure connections itself, it is necessary to use it in conjunction with a separate tool that provides this security. We recoommend PuTTY, which must be installed on your PC and configured correctly to provide secure X-Windows connections.

PuTTY is the same tool used to provide all interactive login from Windows to Unix systems at the Lab. Thus, it should already be available on your system. PuTTY and Xming are designed to work together so that X applications you launch from within the PuTTY login windows will use the encrypted channel created by PuTTY to secure the network traffic used by the x server against sniffing.

NOTE: While it is possible to use X-windows without a secure product like PuTTY, this is no longer allowed at the JLab due to security concerns.

Installing Xming

Xming is free software that can be downloaded from XMing’s website — http://sourceforge.net/projects/xming/. On their webiste, under Releases, Public Domain Releases, please install Xming, which would be the latest version. If you will be doing anything specail with fonts, please install Xming-fonts from the same box. This additional installer provides standard core X fonts (which are usually required) and optional extended Bitstream Vera replacement fonts from DejaVue

Configuring PuTTY to Secure X-Windows

PuTTY should be preconfigured to work in conjunction with Xming. The only configuration item is the flag that tells PuTTY to forward X connections. This is set in the PuTTY config panel under connection -> ssh -> tunnels. “Enable X11 Forwarding” should be checked, and the X Display Location box should be set to “localhost:0”.

Starting an X Windows session with SSH X11 Tunneling

All connections are initiated through PuTTy. Xming will simply provide an X-server in much the same manner as a standard Unix workstation. PuTTy will forward your X information from each host when you establish a connection.

  1. Start the X Server on your PC — Xming, that is — either each time you reboot your PC or whenever you want to use X Windows:
  2. Click the Start button
  3. Select All Programs >> Xming >> Xming.
  4. Xming will appear in your system tray (lower right with clock) as a black X with an orange circle around the middle
  5. Start a PuTTy session with SSH tunneling enabled and login to your Unix account.
  6. Click the Start button
  7. Select All Programs >> PuTTY >> PUTTY
  8. Select an X11 enabled session and click “Load”
  9. Login

Using this configuration, an X-Windows window will automatically open whenever you start an X-Windows program on the remote Unix host.

Some graphic tutorials: https://superuser.com/questions/592185/how-do-i-get-x11-forwarding-to-work-on-windows-with-putty-and-xming

Python code configure:

First install tkinter

sudo apt-get install python3-tk

import tkinter
import matplotlib
matplotlib.use(‘TkAgg’)
import matplotlib.pyplot as plt

--

--