我有几个主题的数据,想为每个主题作图。目标是遍历各个主题,提取当前主题的数据,然后绘制。绘制第一个主题的数据后,程序应停止并等待用户输入,以便可以安心地检查该主题的图。这怎么可能?
注意:我对创建子图不感兴趣。 我正在使用PyCharm和TkAgg后端。
import matplotlib.pyplot as plt
import numpy as np
data_per_subject = [np.array([1,2]),
np.array([3,4]),
np.array([5,6])]
for data in data_per_subject:
# open figure and plot data of current subject
fig, ax = plt.subplots()
plt.plot(data)
# Here some magic has to take place, so that the program waits for my
# input. The importent thing is, that I have to be able to inspect
# the plot for the current subject while the programm is waiting for my
# input!
# close figure
plt.close()