Note
Go to the end to download the full example code
The Simplest View¶
The simplest example: We make a view of a line! Views can be created quickly
using matplotview.view()
.
9 from matplotview import view
10 import matplotlib.pyplot as plt
11
12 fig, (ax1, ax2) = plt.subplots(1, 2)
13
14 # Plot a line in the first axes.
15 ax1.plot([i for i in range(10)], "-o")
16
17 # Create a view! Turn axes 2 into a view of axes 1.
18 view(ax2, ax1)
19 # Modify the second axes data limits so we get a slightly zoomed out view
20 ax2.set_xlim(-5, 15)
21 ax2.set_ylim(-5, 15)
22
23 fig.show()
Total running time of the script: (0 minutes 0.205 seconds)