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?