WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Error when specifying truths for 1-D data #285

@mj-will

Description

@mj-will

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])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions