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

holoview.Div() doesn't display #5963

Closed
butsuri43 opened this issue Oct 27, 2023 · 3 comments · Fixed by holoviz/panel#6365
Closed

holoview.Div() doesn't display #5963

butsuri43 opened this issue Oct 27, 2023 · 3 comments · Fixed by holoviz/panel#6365

Comments

@butsuri43
Copy link

The hv.Div command produces output that is not visible in JupyterLab. The output is also not visible in the holoviews docs, https://holoviews.org/reference/elements/bokeh/Div.html.

ALL software version info

the latest software versions do not work (python 3.10):

bokeh                     3.3.0              pyhd8ed1ab_0    conda-forge
holoviews                 1.18.0             pyhd8ed1ab_0    conda-forge
panel                     1.3.0              pyhd8ed1ab_0    conda-forge
param                     2.0.0              pyhca7485f_0    conda-forge
#
jupyter-lsp               2.2.0              pyhd8ed1ab_0    conda-forge
jupyter_client            8.5.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.4.0           py310hff52083_0    conda-forge
jupyter_events            0.8.0              pyhd8ed1ab_0    conda-forge
jupyter_server            2.9.1              pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.4.4              pyhd8ed1ab_1    conda-forge
jupyterlab                4.0.7              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.25.0             pyhd8ed1ab_0    conda-forge
numpy                     1.26.0          py310hb13e2d6_0    conda-forge
pandas                    2.1.2           py310hcc13569_0    conda-forge
pyviz_comms               3.0.0              pyhd8ed1ab_0    conda-forge

The first combination that works, albeit without the caption (python 3.10):

bokeh                     2.4.3              pyhd8ed1ab_3    conda-forge
holoviews                 1.17.1             pyhd8ed1ab_0    conda-forge
panel                     0.14.4             pyhd8ed1ab_0    conda-forge
param                     1.13.0             pyh1a96a4e_0    conda-forge
#
jupyter-lsp               2.2.0              pyhd8ed1ab_0    conda-forge
jupyter_client            8.5.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.4.0           py310hff52083_0    conda-forge
jupyter_events            0.8.0              pyhd8ed1ab_0    conda-forge
jupyter_server            2.9.1              pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.4.4              pyhd8ed1ab_1    conda-forge
jupyterlab                4.0.7              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.25.0             pyhd8ed1ab_0    conda-forge
numpy                     1.26.0          py310hb13e2d6_0    conda-forge
pandas                    2.1.2           py310hcc13569_0    conda-forge
pyviz_comms               3.0.0              pyhd8ed1ab_0    conda-forge

Description of expected behavior and the observed behavior

When running hv.Div(text) the output should be similar to the one obtained with bokeh. The first example from holoviews' docs,https://holoviews.org/reference/elements/bokeh/Div.html, should result in:
image

Related issue: #4743.

In the software version combination that work for me a milder case of the issue described there is visible (the title levels are shwon correctly, only the caption is missing):
image

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

From holoviews' docs:

import holoviews as hv
hv.extension("bokeh")

hv.Div("""
<h1>Div</h1>
<h3>A simple demo</h2>

<figure>
<img src="https://assets.holoviews.org/logo/holoviews_color_icon_500x500.png" height='200' width='200'>
<figcaption><b>Fig 1:</b> This is a figure caption with $$LaTeX$$</figcaption>
""")

Screenshots or screencasts of the bug in action

image

See also missing outputs in: https://holoviews.org/reference/elements/bokeh/Div.html

@rsdenijs
Copy link

I am having the same issue

@hoxbro
Copy link
Member

hoxbro commented Feb 19, 2024

Behind the scene hv.Div uses panel.models.markup.HTML, this container has visibility: hidden, to see this run this with bokeh serve, and look through the inspector.

from panel.models.markup import HTML
from bokeh.io import curdoc, show
from html import escape

text="""
<h1>Div</h1>
<h3>A simple demo</h2>
<figure>
<img src="https://assets.holoviews.org/logo/holoviews_color_icon_500x500.png" height='200' width='200'>
<figcaption><b>Fig 1:</b> This is a figure caption with $$LaTeX$$</figcaption>
"""
html = HTML(text=escape(text), width=200, height=200)
curdoc().add_root(html)

image

This seems to have been introduced in holoviz/panel#5275, where the container is set to hidden but never changed back to visible. The simplest fix is to add this.style_redraw to the end of render, but it could break the optimization done in the original PR. Thoughts @philippjfr?

https://github.com/holoviz/panel/blob/0d026d651aa811e56b70bb1f45b00a4859931441/panel/models/html.ts#L75

Copy link

This issue 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 a pull request may close this issue.

3 participants