arviz icon indicating copy to clipboard operation
arviz copied to clipboard

`plot_compare` incorrectly places `min_ic` line and `ic_diff` triangles when `order_by_rank=False`

Open billbrod opened this issue 2 years ago • 2 comments

Describe the bug If order_by_rank=False when calling plot_compare, the models are arranged in the same order as in the comp_df argument. However, the min_ic line always ends up at the x-location of the top model (not the best model) and the ic_diff triangles always end up plotted for all models except the top one (instead of all models except the best one).

To Reproduce

Here's the correct behavior when order_by_rank=True

model_compare = az.compare({'Centered 8 schools': az.load_arviz_data('centered_eight'), 
                            'Non-centered 8 schools': az.load_arviz_data('non_centered_eight')})
az.plot_compare(model_compare)

Selection_042

And then here's the incorrect behavior when the ordering changes:

az.plot_compare(model_compare.sort_values('rank', ascending=False), order_by_rank=False)

Selection_043

Expected behavior I expect the min_ic line to be drawn at the x-location of the best model and the ic_diff triangles to be plotted for all models except the best one.

Additional context arviz version 0.11.2.

billbrod avatar Sep 14 '22 21:09 billbrod

@billbrod I would like to work on this

S-Eemani avatar May 15 '23 12:05 S-Eemani

That would be great @S-Eemani, let us know if you need any help sending the PR

OriolAbril avatar May 15 '23 15:05 OriolAbril