Approach to graphing with matplot

11 hours ago 1
ARTICLE AD BOX

So I have the following problem:

I have several pandas Series's which I want to graph using matplotlib's subplot.

I came up with the following code

items = [expcat, inccat, expmonth, incmonth] fig, axes = plt.subplots(2,2) axes n = 0 for i in range(2) : for j in range(2) : n = n + 1 print(n) axes[i, j].plot( items[n-1].cumsum(), color = "red", linestyle = "dashed", label = n ) fig.subplots_adjust(wspace = 0, hspace = 0)

Now, this works but it's rather ugly. The problem arises because I have two sets which I want to iterate on, namely the index on the axes and the Series's on the Python list.

Read Entire Article