A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://matplotview.readthedocs.io/en/latest/examples/plot_01_multiple_artist_view.html below:

A View With Several Plot Elements — matplotview 1.0.0 documentation

A View With Several Plot Elements

A simple example with an assortment of plot elements.

 8 from matplotview import view
 9 import matplotlib.pyplot as plt
10 import numpy as np
11
12 fig, (ax1, ax2) = plt.subplots(1, 2)
13
14 # Plot a line, circle patch, some text, and an image...
15 ax1.plot([i for i in range(10)], "r")
16 ax1.add_patch(plt.Circle((3, 3), 1, ec="black", fc="blue"))
17 ax1.text(10, 10, "Hello World!", size=20)
18 ax1.imshow(np.random.rand(30, 30), origin="lower", cmap="Blues", alpha=0.5,
19            interpolation="nearest")
20
21 # Turn axes 2 into a view of axes 1.
22 view(ax2, ax1)
23 # Modify the second axes data limits to match the first axes...
24 ax2.set_aspect(ax1.get_aspect())
25 ax2.set_xlim(ax1.get_xlim())
26 ax2.set_ylim(ax1.get_ylim())
27
28 fig.tight_layout()
29 fig.show()

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

Gallery generated by Sphinx-Gallery


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4