`plot_compare` incorrectly places `min_ic` line and `ic_diff` triangles when `order_by_rank=False`
- Dominant language
- TeX
- Stars
- 1.9k
- Forks
- 507
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 3
Description
**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`
```python
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:
```python
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`.
Contributor guide
Research direction
Start at the plot_compare entry point and reproduce the two calls shown in the issue, comparing order_by_rank=True with the reordered comp_df and order_by_rank=False. Done means min_ic is positioned at the best model and ic_diff triangles appear for every model except the best one in the reordered plot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100