8000 Add whats_new entry · matplotlib/matplotlib@5bd6b55 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5bd6b55

Browse files
committed
Add whats_new entry
1 parent 15b7bcd commit 5bd6b55

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Add ``widths``, ``heights`` and ``angles`` setter to ``EllipseCollection``
2+
--------------------------------------------------------------------------
3+
4+
The ``widths``, ``heights`` and ``angles`` values of the `~matplotlib.collections.EllipseCollection`
5+
can now be changed after the collection have been created.
6+
7+
.. plot::
8+
:include-source: true
9+
10+
import matplotlib.pyplot as plt
11+
from matplotlib.collections import EllipseCollection
12+
import numpy as np
13+
14+
rng = np.random.default_rng(0)
15+
16+
widths = (2, )
17+
heights = (3, )
18+
angles = (45, )
19+
offsets = rng.random((10, 2)) * 10
20+
21+
fig, ax = plt.subplots()
22+
23+
ec = EllipseCollection(
24+
widths=widths,
25+
heights=heights,
26+
angles=angles,
27+
offsets=offsets,
28+
units='x',
29+
offset_transform=ax.transData,
30+
)
31+
32+
ax.add_collection(ec)
33+
ax.set_xlim(-2, 12)
34+
ax.set_ylim(-2, 12)
35+
36+
new_widths = rng.random((10, 2)) * 2
37+
new_heights = rng.random((10, 2)) * 3
38+
new_angles = rng.random((10, 2)) * 180
39+
40+
ec.set(widths=new_widths, heights=new_heights, angles=new_angles)

0 commit comments

Comments
 (0)
0