Bubbleviz¤
The Bubbleviz
module produces bubble charts, a variant on word clouds, that produces circles ("bubbles") for each term based on the term's frequency in a text or collection of texts.
lexos.visualization.bubbleviz.BubbleChart
¤
Bubble chart.
Source code in lexos\visualization\bubbleviz\__init__.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
__init__(BubbleChartModel)
¤
Instantiate a bubble chart from a BubbleChartModel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
BubbleChartModel |
BubbleChartModel
|
A BubbleChartModel |
required |
Notes
- If "area" is sorted, the results might look weird.
- If "limit" is raised too high, it will take a long time to generate the plot
- Based on https://matplotlib.org/stable/gallery/misc/packed_bubbles.html.
Source code in lexos\visualization\bubbleviz\__init__.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
center_distance(bubble, bubbles)
¤
Centre distance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bubble |
np.ndarray
|
Bubble array. |
required |
bubbles |
np.ndarray
|
Bubble array. |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
np.ndarray: The centre distance. |
Source code in lexos\visualization\bubbleviz\__init__.py
109 110 111 112 113 114 115 116 117 118 119 |
|
center_of_mass()
¤
Centre of mass.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The centre of mass. |
Source code in lexos\visualization\bubbleviz\__init__.py
101 102 103 104 105 106 107 |
|
check_collisions(bubble, bubbles)
¤
Check collisions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bubble |
np.ndarray
|
Bubble array. |
required |
bubbles |
np.ndarray
|
Bubble array. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The length of the distance between bubbles. |
Source code in lexos\visualization\bubbleviz\__init__.py
134 135 136 137 138 139 140 141 142 143 144 145 |
|
collapse(n_iterations=50)
¤
Move bubbles to the center of mass.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_iterations |
int
|
Number of moves to perform. |
50
|
Source code in lexos\visualization\bubbleviz\__init__.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
collides_with(bubble, bubbles)
¤
Collide.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bubble |
np.ndarray
|
Bubble array. |
required |
bubbles |
np.ndarray
|
Bubble array. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The minimum index. |
Source code in lexos\visualization\bubbleviz\__init__.py
147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
outline_distance(bubble, bubbles)
¤
Outline distance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bubble |
np.ndarray
|
Bubble array. |
required |
bubbles |
np.ndarray
|
Bubble array. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The outline distance. |
Source code in lexos\visualization\bubbleviz\__init__.py
121 122 123 124 125 126 127 128 129 130 131 132 |
|
plot(ax, labels, colors, font_family='Arial')
¤
Draw the bubble plot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
matplotlib.axes.Axes
|
The matplotlib axes. |
required |
labels |
List[str]
|
The labels of the bubbles. |
required |
colors |
List[str]
|
The colors of the bubbles. |
required |
font_family |
str
|
The font family. |
'Arial'
|
Source code in lexos\visualization\bubbleviz\__init__.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
lexos.visualization.bubbleviz.BubbleChartModel
¤
Bases: BaseModel
Ensure BubbleChart inputs are valid.
Source code in lexos\visualization\bubbleviz\__init__.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
check_area_not_empty(v)
¤
Ensure area
is not empty.
Source code in lexos\visualization\bubbleviz\__init__.py
49 50 51 52 53 54 |
|
check_terms_not_empty(v)
¤
Ensure terms
is not empty.
Source code in lexos\visualization\bubbleviz\__init__.py
42 43 44 45 46 47 |
|