I'm stumped by the use of 'figsize' to change the size of a plot. Perhaps I don't fully understand how matplotlib works. The code below is from an earlier question from me regarding plotting series with different scales in one graph, using two axis. Prin_Balances is a dataframe consisting of floating numbers, the column names should be self explanatory and correspond to features.
fig, ax = plt.subplots()
# plt.figure(figsize=(9,6))
plt.xticks(rotation=45)
plt.plot(Prin_Balances['UPB'], '--r', label='UPB')
plt.legend()
ax.tick_params('Bal', colors='r')
# Get second axis
ax2 = ax.twinx()
plt.plot(Prin_Balances['1 Mos'], label='1 Mos', color = 'blue')
plt.plot(Prin_Balances['2 Mos'], label='2 Mos', color = 'green')
plt.plot(Prin_Balances['3 Mos'], label='3 Mos', color = 'yellow')
plt.plot(Prin_Balances['> 3 Mos'], label='>3 Mos', color = 'purple')
plt.legend()
ax.tick_params('vals', colors='b')
Now when I run this code, I get a nice, but small graph:
How can I change the size of this graph? The point in the code at which I invoke the second line ('plt.figure') seems to have an effect on the output, in some instances drawing an empty box above a new plot with different labels. (I have not included a shot of this, as I am using Juypter notebook and the two graphs are can only be viewed by scrolling down the output window.