Error when specifying `truths` for 1-D data
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 576
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
Calling corner.corner with 1-dimensional data and truths leads to a TypeError, see the traceback and example below.
As far as I can tell, this is new to v2.2.3 and works in previous versions.
Traceback
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mjwill/.conda/envs/nessai/lib/python3.10/site-packages/corner/corner.py", line 280, in corner
return arviz_corner(
File "/home/mjwill/.conda/envs/nessai/lib/python3.10/site-packages/corner/arviz_corner.py", line 136, in arviz_corner
fig = corner_impl(
File "/home/mjwill/.conda/envs/nessai/lib/python3.10/site-packages/corner/core.py", line 457, in corner_impl
overplot_lines(fig, truths, reverse=reverse, color=truth_color)
File "/home/mjwill/.conda/envs/nessai/lib/python3.10/site-packages/corner/core.py", line 847, in overplot_lines
axes[k1, k1].axvline(xs[k1], **kwargs)
TypeError: 'AxesSubplot' object is not subscriptable
Minimum example
import corner
import numpy as np
rng = np.random.default_rng()
data = rng.standard_normal(size=(1000, 1))
corner.corner(data, truths=[0])
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 with the minimum example in the issue and inspect corner/core.py, especially overplot_lines, where the traceback reports the failure. Confirm that corner.corner accepts one-dimensional data with truths=[0] without raising TypeError and still produces the truth marker.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100