Suppose I have:
import matplotlib.pyplot as plt def generate_plot(data): plt.plot(...) return plt we assume that _data is an iterable with length 4.
if "__name__" = "__main__": _data = .... plt.figure(1) for data_i, index in _data, range(4): plt.subplot(2,2,index+1) ??????? <---- what goes here? plt.savefig(...) Can I call generate_plot such that the graph plotted is placed in position index? If so, how?
To be honest, I don't quite understand how the plt object works in Matplotlib.