Skip to content

System Names Missing from ProportionShift #47

Closed

Description

@milo-trujillo

When I plot other kinds of divergence such as JSD, the system names are written next to purple and orange bars at the top of the plot. However, with ProportionShift those top bars are unlabeled (see attached).

Image

Comparing the two get_shift_graph definitions in shifts.py the main differences appears to be that JSD passes all_pos_contributions while ProportionShift does not, and ProportionShift passes an explicit show_total=False. Here's the JSD definition:

def get_shift_graph(
self,
top_n=50,
show_plot=True,
detailed=False,
text_size_inset=True,
cumulative_inset=True,
title=None,
filename=None,
**kwargs
):
if self.alpha == 1 and self.reference_value == 0:
all_pos_contributions = True
else:
all_pos_contributions = False
if title is None:
title = ""
ax = super().get_shift_graph(
top_n=top_n,
text_size_inset=text_size_inset,
cumulative_inset=cumulative_inset,
detailed=detailed,
show_plot=show_plot,
filename=filename,
title=title,
all_pos_contributions=all_pos_contributions,
**kwargs
)
return ax

And the ProportionShift definition:

def get_shift_graph(
self,
top_n=50,
show_plot=True,
detailed=False,
text_size_inset=True,
cumulative_inset=True,
title=None,
filename=None,
**kwargs
):
if title is None:
title = ""
ax = super().get_shift_graph(
top_n=top_n,
text_size_inset=text_size_inset,
cumulative_inset=cumulative_inset,
detailed=detailed,
show_plot=show_plot,
filename=filename,
show_total=False,
title=title,
**kwargs
)
return ax

When I add all_pos_contributions=True to ProportionShift it does add the system names as desired, but also breaks the plot and puts all bars on the right-hand side. I haven't been able to track down exactly where the system names are added to the plot, but hopefully this can help with debugging.

Activity

  1. andyreagan commented on Jun 30, 2026

    @andyreagan
    Collaborator

    @milo-trujillo I had claude take a swing at this in #48, and it looks good to me. Could you install from the branch and confirm it looks right on your end?

    pip install git+https://github.com/ryanjgallagher/shifterator.git@fix/issue-47-proportionshift-system-names
    

    Force a reinstall over an existing copy with pip install --force-reinstall --no-deps.
    To know that the pip install worked, confirm that you have version 0.5.1 via import shifterator; print(shifterator.__version__).
    Then re-run your ProportionShift(...).get_shift_graph(...).

  2. milo-trujillo commented on Jun 30, 2026

    @milo-trujillo
    ContributorAuthor

    I've confirmed that this has the desired effect on my end.

    If the fix is separating out "top bar system names" from the logic of "flip bar direction for metrics where sign indicates directionality," would it make more sense to remove the system name logic from all_pos_contributions and set label_total_with_system_names to default true for all plot types?

    Additionally, the pull request doesn't add the new parameter to the plotting documentation ;)

    In any case, thanks so much for your help!

  3. andyreagan commented on Aug 27, 2026

    @andyreagan
    Collaborator

    Thanks for confirming! Good catch on the docs — added label_total_with_system_names to the plotting options in #48 (87b5546).

  4. added a commit that references this issue on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions