Skip to content

Commit

Permalink
Fix hist on overlay (#5995)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Nov 23, 2023
1 parent 6e5eacf commit 2514f97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 85 deletions.
83 changes: 0 additions & 83 deletions doc/Homepage.ipynb

This file was deleted.

2 changes: 1 addition & 1 deletion holoviews/operation/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def _process(self, element, key=None):
if normed == 'height':
hist /= hist.max()
else:
hist, edges = np.histogram(data, normed=normed, weights=weights, bins=edges)
hist, edges = np.histogram(data, density=normed, weights=weights, bins=edges)
if self.p.weight_dimension and self.p.mean_weighted:
hist_mean, _ = np.histogram(data, density=False, bins=self.p.num_bins)
hist /= hist_mean
Expand Down
12 changes: 11 additions & 1 deletion holoviews/tests/core/test_layouts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""
Tests of Layout and related classes
"""
import numpy as np
import pytest

from holoviews import (
AdjointLayout,
Element,
Expand All @@ -10,7 +13,7 @@
NdLayout,
Overlay,
)
from holoviews.element import Curve, HLine
from holoviews.element import Curve, HLine, Image
from holoviews.element.comparison import ComparisonTestCase


Expand Down Expand Up @@ -129,7 +132,14 @@ def test_adjointlayout_overlay_adjoined_holomap_nomatch_too_many(self):
with self.assertRaises(ValueError):
(self.view1 << self.view2 << self.view3) * (self.hmap << dim_view)

@pytest.mark.usefixtures("mpl_backend")
def test_histogram_image_hline_overlay(self):
image = Image(np.arange(100).reshape(10, 10))
overlay = image * HLine(y=0)
element = overlay.hist()

assert isinstance(element, AdjointLayout)
assert element.main == overlay

class NdLayoutTest(CompositeTest):

Expand Down

0 comments on commit 2514f97

Please sign in to comment.