I am using a post processing plot script written in python, using python 3.7 and OSX 10.14
The script is probably not optimized, but it works good enough when I use my external monitors. When I try to run it on my macbook pro 15" monitor (2018), it freezes and becomes extremely slow and unresponsive unless I set the figure dimension small enough.
I have no idea of the reason, and I haven't found any explanation browsing the internet. Any clue on what can cause this behaviour and how I can fix it?
This is the 'cut' version of the script I'm running.
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
from matplotlib.patches import Rectangle, Circle
import sys
def main(iter0,iterN,its,out_dir='output'):
it0 = int(iter0)
itN = int(iterN)
itstep = int(its)
a = list(range(it0,itN+1,itstep))
loaded_steps=len(a)
e = np.loadtxt(out_dir+'/energy_data_dynamics')
#... load many other files
plt.ion()
fig = plt.figure(figsize=(20, 20),facecolor="white") #THESE DIMENSIONS WORK FOR ANY EXTERNAL SCREEN
# fig = plt.figure(figsize=(10, 10),facecolor="white") #THESE DIMENSIONS WORK FOR MACBOOK SCREEN
it = 0
for index in range(0,loaded_steps):
plt.cla()
plt.axes().set_aspect('equal')
#... plot many other subplots
ax414=plt.subplot(414)
ax414.plot(e[it0+it,0], e[it0+it,2], marker="o", color="crimson", ms=15)
ax414.plot(e[it0:itN+1,0], e[it0:itN+1,2],'-r')
ax414.set_title("Energy")
plt.show()
plt.pause(0.0000000001)
it+=itstep
if index == loaded_steps-1:
input("Plot finished - Press [enter] to continue.")
if __name__ == '__main__':
matplotlib.use("TkAgg")
its = 1
out_dir = 'output'
if len(sys.argv)>=4:
its = sys.argv[3]
if len(sys.argv)>=5:
out_dir = sys.argv[4]
main(sys.argv[1],sys.argv[2],its,out_dir)