Note
Go to the end to download the full example code
Disabling Line Scaling¶
By default, matplotview scales the line thickness settings for lines and markers to match the zoom level.
This can be disabled via the scale_lines parameter of matplotview.view()
.
8 import matplotlib.pyplot as plt
9 from matplotview import view
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("Zoom View With Line Scaling")
19 view(ax2, ax1, scale_lines=True) # Default, line scaling is ON
20 ax2.set_xlim(0.33, 0.66)
21 ax2.set_ylim(0.33, 0.66)
22
23 ax3.set_title("Zoom View Without Line Scaling")
24 view(ax3, ax1, scale_lines=False) # Line scaling is OFF
25 ax3.set_xlim(0.33, 0.66)
26 ax3.set_ylim(0.33, 0.66)
27
28 fig.tight_layout()
29 fig.show()
Total running time of the script: (0 minutes 0.389 seconds)