Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 781e7f7

Browse files
committed
Add whats_new entry
1 parent c92f106 commit 781e7f7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)