Slope — Before / After Comparison Chart
Signature
sp.slope(title, labels, left, right, *, variant="basic", left_label="Before", right_label="After", palette=None, show_text=True, **kwargs) -> Chart
Description
sp.slope() renders the entire slope-chart family: two parallel value axes (left / right) with one connector per row. The variant keyword swaps the connector style without changing any other parameter. Slope charts excel at before/after comparisons, A/B test outcomes, ranking shifts, KPI changes between periods, and any pair-wise change across many entities.
Parameters
| Parameter | Used by variants |
|---|---|
left_label | diverging |
palette | bumps, monochrome |
right_label | diverging |
show_text | basic, bumps, curved, highlighted, monochrome, stepped, thick |
width | diverging |
Returns
Chart — object with .html property and .show() method.
Tips
- Use
sort_order="asc"/"desc"to reorder rows byleftvalue before drawing. - The
"diverging"and"thick"variants encode magnitude visually — perfect for executive summaries. - For rank shifts (positions in a league), prefer
"bumps"rather than"basic". - Combine
palette=with"monochrome"to match brand colours per category.
Signature
sp.slope(title, labels, left, right, *, variant="basic", left_label="Before", right_label="After", palette=None, show_text=True, **kwargs) -> Chart
Description
sp.slope() produit toute la famille des slope charts : deux axes de valeurs parallèles (gauche / droite) avec un connecteur par ligne. Le mot-clé variant permute le style du connecteur sans changer aucun autre paramètre. Idéal pour comparer avant/après, résultats A/B, changements de classement, KPI entre périodes, et toute évolution par paire sur de nombreuses entités.
Paramètres
| Paramètre | Utilisé par variantes |
|---|---|
left_label | diverging |
palette | bumps, monochrome |
right_label | diverging |
show_text | basic, bumps, curved, highlighted, monochrome, stepped, thick |
width | diverging |
Retour
Chart — objet avec propriété .html et méthode .show().
Astuces
- Utilisez
sort_order="asc"/"desc"pour réordonner les lignes selonleftavant le rendu. - Les variantes
"diverging"et"thick"encodent visuellement la magnitude — parfaites pour un résumé exécutif. - Pour les changements de rang (positions dans un classement), préférez
"bumps"à"basic". - Combinez
palette=avec"monochrome"pour aligner les couleurs sur les catégories de marque.