How Can I Have A Stacked Plot With A Shared X Axis And Multiple Y Axis On One Of The Plots?
I am trying to modify this example so also have a second plot on top sharing the same X-axis. Unfortunately, it is not clear how to add subplots to this structure. I have tried to
Solution 1:
You can create a new host subplot and share the xaxis.
replace host = host_subplot(111, axes_class=AA.Axes)
with host = host_subplot(211, axes_class=AA.Axes)
replace the lines below your line ## Attempts to add stacked plot on top
with
host2 = host_subplot(212, axes_class=AA.Axes, sharex=host)
host2.plot([0,1,2], [5,6,7])
host2.set_title('Sharing X axis')
plt.tight_layout()
plt.draw()
plt.show()
this results in
Post a Comment for "How Can I Have A Stacked Plot With A Shared X Axis And Multiple Y Axis On One Of The Plots?"