Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hist on overlay #5995

Merged
merged 17 commits into from
Nov 23, 2023
Merged
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
Loading