File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ Add ``RectangleCollection ``
2+ ---------------------------
3+
4+ The `~matplotlib.collections.RectangleCollection ` is added to create collection of `~matplotlib.patches.Rectangle `
5+
6+ .. plot ::
7+ :include-source: true
8+
9+ import matplotlib.pyplot as plt
10+ from matplotlib.collections import RectangleCollection
11+ import numpy as np
12+
13+ rng = np.random.default_rng(0)
14+
15+ widths = (2, )
16+ heights = (3, )
17+ angles = (45, )
18+ offsets = rng.random((10, 2)) * 10
19+
20+ fig, ax = plt.subplots()
21+
22+ ec = RectangleCollection(
23+ widths=widths,
24+ heights=heights,
25+ angles=angles,
26+ offsets=offsets,
27+ units='x',
28+ offset_transform=ax.transData,
29+ )
30+
31+ ax.add_collection(ec)
32+ ax.set_xlim(-2, 12)
33+ ax.set_ylim(-2, 12)
You can’t perform that action at this time.
0 commit comments