Skip to content

Commit 7179889

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 073613c commit 7179889

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/napari_matplotlib/histogram.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ def on_update_layers(self) -> None:
162162

163163
def draw(self) -> None:
164164
"""Clear the axes and histogram the currently selected layer/slice."""
165-
166165
# get the colormap from the layer depending on its type
167166
if isinstance(self.layers[0], napari.layers.Points):
168167
colormap = self.layers[0].face_colormap
@@ -183,16 +182,18 @@ def draw(self) -> None:
183182
if data is None:
184183
return
185184

186-
_, bins, patches = self.axes.hist(data, bins=50, edgecolor="white", linewidth=0.3)
185+
_, bins, patches = self.axes.hist(
186+
data, bins=50, edgecolor="white", linewidth=0.3
187+
)
187188

188189
# recolor the histogram plot
189190
if colormap is not None:
190-
self.bins_norm = (bins - bins.min())/(bins.max() - bins.min())
191+
self.bins_norm = (bins - bins.min()) / (bins.max() - bins.min())
191192
colors = colormap.map(self.bins_norm)
192193

193194
# Set histogram style:
194195
for idx, patch in enumerate(patches):
195-
patch.set_facecolor(colors[idx])
196+
patch.set_facecolor(colors[idx])
196197

197198
# set ax labels
198199
self.axes.set_xlabel(x_axis_name)

src/napari_matplotlib/tests/test_histogram.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def test_histogram_3D(make_napari_viewer, brain_data):
3636

3737

3838
def test_feature_histogram(make_napari_viewer):
39-
4039
n_points = 1000
4140
random_points = np.random.random((n_points, 3)) * 10
4241
random_directions = np.random.random((n_points, 3)) * 10
@@ -74,7 +73,6 @@ def test_feature_histogram(make_napari_viewer):
7473

7574
@pytest.mark.mpl_image_compare
7675
def test_feature_histogram_vectors(make_napari_viewer):
77-
7876
n_points = 1000
7977
np.random.seed(42)
8078
random_points = np.random.random((n_points, 3)) * 10
@@ -99,7 +97,6 @@ def test_feature_histogram_vectors(make_napari_viewer):
9997

10098
@pytest.mark.mpl_image_compare
10199
def test_feature_histogram_points(make_napari_viewer):
102-
103100
np.random.seed(0)
104101
n_points = 1000
105102
random_points = np.random.random((n_points, 3)) * 10
@@ -143,6 +140,7 @@ def test_change_layer(make_napari_viewer, brain_data, astronaut_data):
143140
assert_figures_not_equal(widget.figure, fig1)
144141

145142

146-
if __name__ == '__main__':
143+
if __name__ == "__main__":
147144
import napari
148-
test_feature_histogram_points(napari.Viewer)
145+
146+
test_feature_histogram_points(napari.Viewer)

0 commit comments

Comments
 (0)