depictr.dumbbell_plot#

depictr.dumbbell_plot(data, category, value, group, legend_inside=False, title=None)#

Dumbbell plot pairing two group values per category.

For a group with exactly two levels, each category becomes one row with a point for each level joined by a segment. The length of the segment is the gap between the two levels, which is the comparison the plot is built to show.

Parameters:
  • data (pandas.DataFrame) – Either one row per category-and-group combination, or raw rows that are averaged to one value per combination.

  • category (str) – The categorical column, one row per level on the y-axis.

  • value (str) – The numeric column plotted along the x-axis.

  • group (str) – A two-level grouping column; its levels are the two points.

  • legend_inside (bool) – When True, place the two-group legend in the top-right of the panel rather than in a right-hand margin.

  • title (str, optional) – Plot title.

Return type:

plotnine.ggplot