File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 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 has 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)
You can’t perform that action at this time.
0 commit comments