Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c92f106 commit 781e7f7Copy full SHA for 781e7f7
doc/users/next_whats_new/add_RectangleCollection.rst
@@ -0,0 +1,33 @@
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)
0 commit comments