Skip to content

Commit a76a3b8

Browse files
committed
Merge branch 'master' of https://github.com/McToel/matplotlib into packed-bubbles
2 parents 7e1598d + 919e27e commit a76a3b8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

examples/misc/packed_bubbles.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
"""
2-
Create a packed bubble / non overlapping bubble chart to represent scalar data.
2+
===================
3+
Packed-bubble chart
4+
===================
5+
6+
Create a packed-bubble chart to represent scalar data.
37
The presented algorithm tries to move all bubbles as close to the center of
4-
mass as possible while avoiding some collisions by moving aroud colliding
8+
mass as possible while avoiding some collisions by moving around colliding
59
objects. In this example we plot the market share of different desktop
610
browsers.
711
"""
@@ -72,7 +76,8 @@ def center_distance(self, bubble, bubbles):
7276
def outline_distance(self, bubble, bubbles):
7377
center_distance = self.center_distance(bubble, bubbles)
7478
return center_distance - bubble[2] - \
75-
bubbles[:, 2] - self.bubble_distance
79+
return (center_distance - bubble[2] -
80+
bubbles[:, 2] - self.bubble_distance)
7681

7782
def check_collisions(self, bubble, bubbles):
7883
distance = self.outline_distance(bubble, bubbles)

0 commit comments

Comments
 (0)