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

Don't try to find closest match if input is empty #5700

Merged
merged 2 commits into from
Apr 28, 2023
Merged

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Apr 28, 2023

Fixes #5694

The function is recursive, and if the input arguments are not the same length, it will raise the error described in the issue.

This PR just adds a check to see if the match is not empty. There seems to be a problem with the coloring when having 1 vs 2 or 3. I will not fix that in this PR.

Code
import holoviews as hv
import numpy as np
import panel as pn

pn.extension()

def sine(ncurves):
    hv_curves = []
    for i in range(ncurves):
        frequency = 2.0
        xs = np.linspace(0.0, 1.0, 500)
        ys = np.sin((i + 1) * frequency * xs) # just a sine wave

        curve = hv.Curve((xs, ys), label="A")
        hv_curves.append(curve)

        ys = 1.1 * np.sin((i + 1) * frequency * xs)  # another, bigger amplitude
        curve = hv.Curve((xs, ys), label="B")
        hv_curves.append(curve)

        ys = 1.2 * np.sin((i + 1) * frequency * xs)  # still another
        curve = hv.Curve((xs, ys), label="C")
        hv_curves.append(curve)

    overlay = hv.Overlay(hv_curves)
    return overlay


ncurves = pn.widgets.IntSlider(name="NCurves", start=1, end=3, value=1).servable()
col = pn.Column(
    ncurves, hv.DynamicMap(pn.bind(sine, ncurves=ncurves)), width=500, height=500
).servable()
screenrecord-2023-04-28_10.48.21.mp4

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2023

Codecov Report

Merging #5700 (9b1dcf4) into main (c74191d) will decrease coverage by 0.01%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##             main    #5700      +/-   ##
==========================================
- Coverage   88.30%   88.30%   -0.01%     
==========================================
  Files         302      302              
  Lines       62603    62605       +2     
==========================================
  Hits        55281    55281              
- Misses       7322     7324       +2     
Impacted Files Coverage Δ
holoviews/core/util.py 86.54% <80.00%> (-0.06%) ⬇️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@hoxbro hoxbro merged commit 4e576fe into main Apr 28, 2023
@hoxbro hoxbro deleted the ignore_closest branch April 28, 2023 11:21
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update_frame throws exception
3 participants