arviz
arviz copied to clipboard
`plot_compare` incorrectly places `min_ic` line and `ic_diff` triangles when `order_by_rank=False`
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)
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)
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 I would like to work on this
That would be great @S-Eemani, let us know if you need any help sending the PR