Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc59f1e2

Browse files
p-j-smithdstansby
authored andcommitted
ensure histograms of integer data have equal bin width
1 parent2fea1b0 commitc59f1e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/napari_matplotlib/histogram.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ def draw(self) -> None:
7070

7171
# Important to calculate bins after slicing 3D data, to avoid reading
7272
# whole cube into memory.
73-
bins=np.linspace(np.min(data),np.max(data),100,dtype=data.dtype)
73+
ifdata.dtype.kind=="i":
74+
# Make sure integer data types have integer sized bins
75+
step= (np.max(data)-np.min(data))//100
76+
bins=np.arange(np.min(data),np.max(data)+step,step)
77+
else:
78+
bins=np.linspace(np.min(data),np.max(data),100)
7479

7580
iflayer.rgb:
7681
# Histogram RGB channels independently

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp