1

I want to plot a figure using python on a supercomputer.

For example, I wrote a script plot.py

import numpy as np
import matplotlib.pyplot as plt
....
....
plt.plot(m) # m is a matrix with size (1000,36) 
plt.show()

If I do:

python3 plot.py

there is no picture. But I can get all other numerical output. (I can get a figure with the same script on my mac with python3.6 but not at supercomputer)

But if I do:

ipython -i --matplotlib=tk -- plot.py 1 2 3 4

or

ipython -i --pylab=tk -- plot.py 1 2 3 4

The plot will show up.

I tried to delete "-i", and it seemed that "-i" is necessary. I don't understand the logic behind it. Why can we not use python3 directly on a supercomputer to plot? And why --matplotlib=tk or --pylab=tk all worked but deleting both of them will not work. And "1 2 3 4" is not necessary.

Could someone help to explain why "ipython -i" works on a supercomputer?

SYuan
  • 161
  • 1
  • 6
  • 3
    What is a "supercomputer"? Is that some local marketing name for a Dell or something? – Mad Physicist Dec 28 '17 at 21:42
  • 1
    maybe its the `i` in front that does your magic, by providing a visual frontend for your supercomputer - its probably related to this: https://ipython.org/ – Patrick Artner Dec 28 '17 at 21:45
  • @MadPhysicist “supercomputer” is the computer clusters we use @ McGill. Here is a link to it: http://www.hpc.mcgill.ca/ – SYuan Dec 28 '17 at 21:51
  • I suggest you contact your support. – atru Dec 28 '17 at 22:06
  • 3
    Most likely you dont have X11 forwarding enabled, or your local cluster has a non graphical backend for matplotlib enabled. This isn’t really a programming question. – Chiel Dec 28 '17 at 22:24

0 Answers0