Allotaxonometer¶
The Dodds (2020) diamond allotaxonograph — a rotated-square rank-rank histogram with iso-divergence contours and a wordshift list. Works on any two ranked lists.
keyflux.viz.allotaxonometer.allotaxonometer(list1, list2, *, alpha=1.0 / 3.0, labels=None, top=25, bins=36, n_contours=8, figsize=(13.0, 7.0), cmap='inferno', contour_color='0.75')
¶
Draw the diamond allotaxonograph (Dodds et al. 2020) of two ranked lists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list1
|
RankedList
|
The first ranked list (its types lean to the left half). |
required |
list2
|
RankedList
|
The second ranked list (its types lean to the right half). |
required |
alpha
|
float
|
Rank-turbulence-divergence tuning parameter; |
1.0 / 3.0
|
labels
|
tuple[str, str] | None
|
|
None
|
top
|
int
|
Number of top contributors in the wordshift panel. |
25
|
bins
|
int
|
Number of bins per axis in the rank-rank histogram. |
36
|
n_contours
|
int
|
Number of iso-divergence contour lines. |
8
|
figsize
|
tuple[float, float]
|
Figure size in inches. |
(13.0, 7.0)
|
cmap
|
str
|
Colormap for the histogram (read under a logarithmic norm). |
'inferno'
|
contour_color
|
str
|
Colour of the iso-divergence contours. |
'0.75'
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Figure
|
class: |
Figure
|
wordshift). The function never calls |
Raises:
| Type | Description |
|---|---|
ValueError
|
If either list is empty (propagated from :func: |
Contract
- Returns a Figure with exactly three axes.
- Inputs are never mutated.
- The histogram, contours, and wordshift all derive from the same aligned
ranks and
rtdcall, so they cannot disagree. - Exclusive types (present in one list only) sit at a tied-last rank on the outer edges.
Examples:
>>> from keyflux.datasets import load_jkbren_example
>>> r1, r2 = load_jkbren_example()
>>> fig = allotaxonometer(r1, r2, alpha=1.0, labels=("A", "B"))
>>> type(fig).__name__
'Figure'
>>> len(fig.axes)
3
Source code in keyflux/viz/allotaxonometer.py
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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |