`overplot_lines` fails when the dataset is one-dimensional
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 576
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
When I call overplot_lines with a 1D dataset I get an error like
...
(.../corner/core.py#line=846), in overplot_lines(fig, xs, reverse, **kwargs)
845 for k1 in range(K):
846 if xs[k1] is not None:
--> 847 axes[k1, k1].axvline(xs[k1], **kwargs)
848 for k2 in range(k1 + 1, K):
849 if xs[k1] is not None:
TypeError: 'Axes' object is not subscriptable
For multi-dimensional data I have code that draws crosshairs on best fit points on the 2D plots and it plots confidence interval lines on the histograms at the top of each column. When I call corner plot on a 1D dataset I see the histogram. I want my code to also work to add the confidence interval lines on the histogram without needing to special case this case.
Instead of giving this exception I would prefer if overplot_lines check if the data is 1D, and if so, do nothing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in corner/core.py at overplot_lines around line 846 and inspect how axes are handled for one-dimensional data. Verify the 1D case avoids the exception while the existing crosshair and confidence-line behavior for multi-dimensional data remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100