I'm plotting 3 charts in one figure.
The first chart came out fine and I could use the methods associated with a matplotlib chart.
fig = plt.figure(constrained_layout = True, figsize = [10,10])
gs = fig.add_gridspec(4,2)
fig_ax_curve = fig.add_subplot(gs[0:2,:])
However, as I proceeded with the second chart:
fig_ax_2_10 = fig.add_subplot(gs[2,:])
fig_ax_2_10 = fig_ax_2_10.plot(yield_history_2_10_30["2Y-10Y Spread"], label = "2Y - 10Y Spread", color = "red")
fig_ax_2_10.axhline(color = "black")
I was unable to execute any of the associated methods and got back:
AttributeError: 'list' object has no attribute 'axhline'
I am aware of an existing question that was similar: Matplotlib Plotting: AttributeError: 'list' object has no attribute 'xaxis'
If I'm not mistaken, my code has already followed what is suggested in that answer to avoid the error, specifically using ax.(methods)