Skip to content

boxpctiles not affecting error bars #399

@mothersup

Description

@mothersup

Description

The argument boxpctiles for plotting error bars in violin, bar, etc, are supposed to be equivalent to boxpctile, adding a box from the 0.25 quantile to the 0.75 quantile when boxpctiles = True. However, I think currently boxpctiles has no effect on the plots.

MVE 1

import numpy as np
import ultraplot as uplt

data = np.array([0, 1, 2, 3]).reshape(-1, 1)

fig, axes = uplt.subplots(ncols=5)
axes[0].violin(data, median=True)
axes[0].format(title='default')

axes[1].violin(data, median=True, boxpctiles=True)
axes[1].format(title='boxpctiles')

axes[2].violin(data, median=True, boxpctile=True)
axes[2].format(title='boxpctile')

axes[3].violin(data, median=True, boxstd=True)
axes[3].format(title='boxstd')

axes[4].violin(data, median=True, boxstds=True)
axes[4].format(title='boxstds')

fig.show()
Image

Expected and actual behaviors

Expected: the same plot as 'boxpctile', with the box starting at 0.75 (Q1) and ending at 2.25 (Q3).
Actual: the same plot as the default arguments, 'boxstd' and 'boxstds'.

MVE 2

import numpy as np
import ultraplot as uplt

data = np.array([0, 1, 2, 3]).reshape(-1, 1)

fig, axes = uplt.subplots(ncols=4)
axes[0].bar(data, median=True, boxpctiles=True, bars=False)
axes[0].format(title='boxpctiles')

axes[1].bar(data, median=True, boxpctile=True, bars=False)
axes[1].format(title='boxpctile')

axes[2].bar(data, median=True, boxstd=True, bars=False)
axes[2].format(title='boxstd')

axes[3].bar(data, median=True, boxstds=True, bars=False)
axes[3].format(title='boxstds')

fig.show()
Image

Expected and actual behaviors

Expected: the same plot as 'boxpctile', with the box starting at 0.75 (Q1) and ending at 2.25 (Q3).
Actual: no error bars, as if the boxpctiles argument has no effect.

Versions

  • ultraplot: 1.65.0
  • numpy: 2.2.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions