Viewing Multiple Axes From A Single View

Views can view multiple axes at the same time, by simply calling matplotview.view() multiple times.

plot 08 viewing 2 axes
 7 import matplotlib.pyplot as plt
 8 from matplotview import view
 9
10 fig, (ax1, ax2, ax3) = plt.subplots(1, 3)
11
12 # We'll plot 2 circles in axes 1 and 3.
13 ax1.add_patch(plt.Circle((1, 1), 1.5, ec="black", fc=(0, 0, 1, 0.5)))
14 ax3.add_patch(plt.Circle((3, 1), 1.5, ec="black", fc=(1, 0, 0, 0.5)))
15 for ax in (ax1, ax3):
16         ax.set_aspect(1)
17         ax.relim()
18         ax.autoscale_view()
19
20 # Axes 2 is a view of 1 and 3 at the same time (view returns the axes it turns into a view...)
21 view(view(ax2, ax1), ax3)
22
23 # Change data limits, so we can see the entire 'venn diagram'
24 ax2.set_aspect(1)
25 ax2.set_xlim(-0.5, 4.5)
26 ax2.set_ylim(-0.5, 2.5)
27
28 fig.show()

Total running time of the script: (0 minutes 0.188 seconds)

Gallery generated by Sphinx-Gallery