Visualisation Reference
plot_affinity_distribution(scores, labels=None)
Plots a Seaborn KDE or histogram of the 0-100 affinity scores. If actual major-gift labels are provided, plots overlaid distributions (Major vs. Non-Major) to show model separation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scores
|
array - like
|
The generated affinity scores (0-100 scale). |
required |
labels
|
array - like
|
The true binary labels for the donors (0=Non-Major, 1=Major). |
None
|
Returns:
| Type | Description |
|---|---|
Axes
|
The underlying axes object for further customization. |
Source code in philanthropy/visualisation/_plots.py
plot_retention_waterfall(starting_donors, acquired, lapsed, recovered)
Generates a step-by-step waterfall chart showing the net change in the donor file year-over-year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
starting_donors
|
int
|
The number of donors at the beginning of the period. |
required |
acquired
|
int
|
The number of newly acquired donors. |
required |
lapsed
|
int
|
The number of donors who lapsed (entered as a positive integer). |
required |
recovered
|
int
|
The number of previously lapsed donors who recovered. |
required |
Returns:
| Type | Description |
|---|---|
Axes
|
The underlying axes object for further customization. |