Skip to content

Commit f0bdb02

Browse files
committed
Set np.linspace dtype based on image dtype for the HistogramWidget
1 parent 9217d10 commit f0bdb02

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/napari_matplotlib/histogram.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
import numpy as np
55
import numpy.typing as npt
66
from matplotlib.container import BarContainer
7-
from qtpy.QtWidgets import QComboBox, QLabel, QVBoxLayout, QWidget
7+
from qtpy.QtWidgets import (
8+
QComboBox,
9+
QLabel,
10+
QVBoxLayout,
11+
QWidget,
12+
)
813

914
from .base import SingleAxesWidget
1015
from .features import FEATURES_LAYER_TYPES
@@ -48,7 +53,7 @@ def draw(self) -> None:
4853

4954
# Important to calculate bins after slicing 3D data, to avoid reading
5055
# whole cube into memory.
51-
bins = np.linspace(np.min(data), np.max(data), 100)
56+
bins = np.linspace(np.min(data), np.max(data), 100, dtype=data.dtype)
5257

5358
if layer.rgb:
5459
# Histogram RGB channels independently

0 commit comments

Comments
 (0)