Editing View Properties

A view’s properties can be edited by simply calling matplotview.view() with the same axes arguments. To stop a viewing, matplotview.stop_viewing() can be used.

Original Plot, An Edited View, A Stopped View
 8 import matplotlib.pyplot as plt
 9 from matplotview import view, stop_viewing
10
11 fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
12
13 # Plot a line, and circle patch in axes 1
14 ax1.set_title("Original Plot")
15 ax1.plot([(i / 10) for i in range(10)], [(i / 10) for i in range(10)], "r-")
16 ax1.add_patch(plt.Circle((0.5, 0.5), 0.1, ec="black", fc="blue"))
17
18 ax2.set_title("An Edited View")
19 # Ask ax2 to view ax1.
20 view(ax2, ax1, filter_set=[plt.Circle])
21 ax2.set_xlim(0.33, 0.66)
22 ax2.set_ylim(0.33, 0.66)
23
24 # Does not create a new view as ax2 is already viewing ax1.
25 # Edit ax2's viewing of ax1, remove filtering and disable line scaling.
26 view(ax2, ax1, filter_set=None, scale_lines=False)
27
28 ax3.set_title("A Stopped View")
29 view(ax3, ax1)  # Ask ax3 to view ax1.
30 ax3.set_xlim(0.33, 0.66)
31 ax3.set_ylim(0.33, 0.66)
32
33 # This makes ax3 stop viewing ax1.
34 stop_viewing(ax3, ax1)
35
36 fig.tight_layout()
37 fig.show()

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

Gallery generated by Sphinx-Gallery