Skip to content

System Names Missing from ProportionShift #47

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.

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