Skip to content

napari_matplotlib.histogram._get_bins returns different bins depending on type of data passed to it #249

Closed
@p-j-smith

Description

@p-j-smith

napari_matplotlib.histogram._get_bins returns fewer bins if the data passed to it are float compared to if they are int.

To reproduce:

import numpy as np
from napari_matplotlib.histogram import _get_bins

data = np.arange(0, 101, dtype=int)
print(_get_bins(data).size)
print(_get_bins(data.astype(float)).size)

which prints:

101
100

To fix, perhaps 100 bins (101 bin edges) should be created with np.linspace for float data

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