Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you plot a graph when developing on a remote machine through ssh only

Tags:

python

ssh

I don't have enough computing power in my desktop, so I usually develop and run the programs on a remote workstation. However, there is a frequent need to plot some graphs in order to visualize what's going on, and I can't do this directly with Putty. I wonder if there is some handy way of doing this.

like image 523
chenaren Avatar asked Jul 03 '26 09:07

chenaren


1 Answers

You can use gnuplot to plot directly within a terminal. For example:

gnuplot> set terminal dumb
Terminal type set to 'dumb'
Options are 'feed  size 79, 24'
gnuplot> set terminal dumb
Terminal type set to 'dumb'
Options are 'feed  size 79, 24'
gnuplot> plot(sin(x))


    1 ++---------------***---------------+---**-----------+--------**-----++
      +                *  *              +  *  **         +(sin(x)) ****** +
  0.8 ++              *   *                 *    *               *    *   ++
      |              *     *               *     *               *     *   |
  0.6 *+             *      *              *     *               *     *  ++
      |*             *      *             *       *             *       *  |
  0.4 +*            *       *             *       *             *       * ++
      |*            *        *            *        *           *        *  |
  0.2 +*           *         *            *        *           *         *++
    0 ++*          *          *          *         *          *          *++
      | *          *          *         *           *         *           *|
 -0.2 ++ *         *          *         *           *         *           *+
      |  *        *           *        *             *        *           *|
 -0.4 ++ *        *            *       *             *       *            *+
      |  *       *              *      *             *      *              *
 -0.6 ++  *      *              *      *             *      *             +*
      |    *    *               *     *               *     *              |
 -0.8 ++   *    *                *   *                 *   *              ++
      +     *  *       +         **  *   +             *  *                +
   -1 ++-----**--------+-----------**----+--------------***---------------++
     -10              -5                 0                5                10

Alternatively, you can use X forwarding to forward graphical things from your remote computer to your local machine.

On Windows, (which I assume you're using because you're using Putty) there's a program called XMing you could use to do this.

Some instructions for using XMing with PuTTY: http://www-inst.eecs.berkeley.edu/~cs61a/fa13/pdfs/connect-windows.pdf (see the second half of the PDF, which I've copied below)

XMing will give you graphical support for your remote connection.

(1) Download XMing from http://sourceforge.net/project/showfiles.php?group_id=156984 Download both Xming and Xming-fonts

(2) Install both, just go with the default settings again.

(3) Open Xlaunch I like the Multiple Window mode, go with whatever style your heart desires Select Start no client You don’t need to change anything on the next two pages.

(4) Tricky step here, open PuTTY On the left settings bar, Look under Connection open up more setting options for SSH Go to X11, Check Enable X11 Forwarding Enter localhost:0 for X display location Enter Host Name information as per the PuTTY Guide, and connect.

(5) Log in, now try commands like emacs

like image 170
pandubear Avatar answered Jul 04 '26 23:07

pandubear



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!