Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scatter set sizes whats new #3130

Merged
merged 3 commits into from
Jun 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/collections_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ collections
:members:
:undoc-members:
:show-inheritance:
:inherited-members:
13 changes: 13 additions & 0 deletions doc/users/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@ show with an int, slice object, numpy fancy indexing, or float. Using a float
shows markers at approximately equal display-coordinate-distances along the
line.

Added size related functions to specialized `Collections`
`````````````````````````````````````````````````````````

Added the `get_size` and `set_size` functions to control the size of
elements of specialized collections (
:class:`~matplotlib.collections.AsteriskPolygonCollection`
:class:`~matplotlib.collections.BrokenBarHCollection`
:class:`~matplotlib.collections.CircleCollection`
:class:`~matplotlib.collections.PathCollection`
:class:`~matplotlib.collections.PolyCollection`
:class:`~matplotlib.collections.RegularPolyCollection`
:class:`~matplotlib.collections.StarPolygonCollection`).


Fixed the mouse coordinates giving the wrong theta value in Polar graph
```````````````````````````````````````````````````````````````````````
Expand Down
21 changes: 21 additions & 0 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,30 @@ class _CollectionWithSizes(Collection):
Base class for collections that have an array of sizes.
"""
def get_sizes(self):
"""
Returns the sizes of the elements in the collection. The
value represents the 'area' of the element.

Returns
-------
sizes : array
The 'area' of each element.
"""
return self._sizes

def set_sizes(self, sizes, dpi=72.0):
"""
Set the sizes of each member of the collection.

Parameters
----------
sizes : ndarray or None
The size to set for each element of the collection. The
value is the 'area' of the element.

dpi : float
The dpi of the canvas. Defaults to 72.0.
"""
if sizes is None:
self._sizes = np.array([])
self._transforms = np.empty((0, 3, 3))
Expand Down