Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 99a3fc0

Browse files
p-j-smithdstansby
authored andcommitted
Set np.linspace dtype based on image dtype for the HistogramWidget
1 parent c481207 commit 99a3fc0

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
@@ -65,7 +70,7 @@ def draw(self) -> None:
6570

6671
# Important to calculate bins after slicing 3D data, to avoid reading
6772
# whole cube into memory.
68-
bins = np.linspace(np.min(data), np.max(data), 100)
73+
bins = np.linspace(np.min(data), np.max(data), 100, dtype=data.dtype)
6974

7075
if layer.rgb:
7176
# Histogram RGB channels independently

0 commit comments

Comments
 (0)