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

HLines and VLines do not work with categorical axes unless vdim is specified #6483

Open
CodyKlingler opened this issue Jan 7, 2025 · 0 comments

Comments

@CodyKlingler
Copy link

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info
hvplot==0.11.1
bokeh==3.6.2

Description of expected behavior and the observed behavior

HLines and VLines do not work with categorical axes unless vdim is specified.

Complete, minimal, self-contained example code that reproduces the issue

hv.Curve(zip([1, 3, 2], ["a", "b", "c"])) * hv.VLines([1.5, 2.5]) # Does not work

d = {"x": [1.5, 2.5], "y": None}
hv.Curve(zip([1, 3, 2], ["a", "b", "c"])) * hv.VLines(d, vdims=["y"]) # works

Stacktrace

ValueError: not enough values to unpack (expected 2, got 1)

Traceback (most recent call last):
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\io\handlers.py", line 412, in run
    exec(self._code, module.__dict__)
  File "C:\Users\my_user\Documents\my_project\hv.py", line 17, in <module>
    pn.panel(x).servable()
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\viewable.py", line 414, in servable
    self.server_doc(title=title, location=location) # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\viewable.py", line 1022, in server_doc
    model = self.get_root(doc)
            ^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\pane\base.py", line 515, in get_root
    root_view, root = self._get_root_model(doc, comm, preprocess)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\pane\base.py", line 456, in _get_root_model
    root = self.layout._get_model(doc, comm=comm)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\layout\base.py", line 182, in _get_model
    objects, _ = self._get_objects(model, [], doc, root, comm)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\layout\base.py", line 164, in _get_objects
    child = pane._get_model(doc, root, model, comm)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\pane\holoviews.py", line 437, in _get_model
    plot = self._render(doc, comm, root)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\panel\pane\holoviews.py", line 531, in _render
    return renderer.get_plot(self.object, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\bokeh\renderer.py", line 68, in get_plot
    plot = super().get_plot(obj, doc, renderer, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\renderer.py", line 239, in get_plot
    plot.update(init_key)
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\plot.py", line 956, in update
    return self.initialize_plot()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\bokeh\element.py", line 3428, in initialize_plot
    self._update_ranges(element, ranges)
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\bokeh\element.py", line 1328, in _update_ranges
    self._update_main_ranges(element, x_range, y_range, ranges)
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\bokeh\element.py", line 1371, in _update_main_ranges
    xfactors, yfactors = self._get_factors(element, ranges)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\bokeh\element.py", line 3379, in _get_factors
    xfs, yfs = sp._get_factors(el, elranges)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\my_user\Documents\my_project\.venv\Lib\site-packages\holoviews\plotting\bokeh\element.py", line 1749, in _get_factors
    xdim, ydim = element.dimensions()[:2]
    ^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant