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

Small improvements to vscode-notebook support #5398

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Aug 19, 2022

VScode notebook did not interactive work with a DynamicMap.

It still does not fully work as pn.config.comms needs to be set to vscode. I think It would be nice if the comms was set by holoviews and not dependent on Panel, but I think this is out of scope for this PR.

With pn.config.comms = vscode:

screenrecord-2022-08-19_11.12.25.mp4

With pn.config.comms = default:

screenrecord-2022-08-19_11.13.20.mp4
import holoviews as hv
import pandas as pd

hv.extension('bokeh')

import panel as pn
pn.config.comms = "vscode"  # <- this is needed for it to work

# creating a dataframe with both an int and an obj dtype
df = pd.DataFrame({
    'count':    [ 0,    1,    2 ], 
    'distance': [ 3,    4,    7 ],
    'length':   [ 5,  -20,   35 ]
})

# set up a DynamicMap where the user can select the y_axis column
y_dim = hv.Dimension('y_column', values=df.columns.tolist(), default='distance')

def return_scatter(col_name):
    return hv.Scatter(df, kdims='count', vdims=[col_name])

hv.DynamicMap(return_scatter, kdims=y_dim).opts(framewise=True, axiswise=True)

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2022

Codecov Report

Merging #5398 (92950b4) into master (8b2ee78) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #5398      +/-   ##
==========================================
- Coverage   88.07%   88.06%   -0.01%     
==========================================
  Files         301      301              
  Lines       61969    61978       +9     
==========================================
+ Hits        54579    54583       +4     
- Misses       7390     7395       +5     
Impacted Files Coverage Δ
holoviews/plotting/renderer.py 71.98% <0.00%> (ø)
holoviews/util/transform.py 85.25% <0.00%> (-0.75%) ⬇️
holoviews/core/data/pandas.py 93.30% <0.00%> (-0.10%) ⬇️
holoviews/tests/core/test_utils.py 99.20% <0.00%> (+<0.01%) ⬆️
holoviews/core/util.py 86.06% <0.00%> (+0.03%) ⬆️

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

@philippjfr
Copy link
Member

Looks good, thanks @hoxbro!

@boustrephon
Copy link

boustrephon commented Jan 17, 2023

When I run the code from @hoxbro , I get the following error. Have I failed to install something?

Python version 3.10.4 (main, Mar 31 2022, 03:37:37) [Clang 12.0.0 ]
Bokeh version is 2.4.2
HoloViews version is 1.14.8
Pandas version is 1.4.2

File ~/opt/anaconda3/envs/py310/lib/python3.10/site-packages/holoviews/core/options.py:1405, in Store.render(cls, obj)
   1403 data, metadata = {}, {}
   1404 for hook in hooks:
-> 1405     ret = hook(obj)
   1406     if ret is None:
   1407         continue
...
--> 370     from jupyter_bokeh.widgets   import BokehModel
    371     from ..pane import panel
    372     model = panel(obj, **kwargs).get_root()

ModuleNotFoundError: No module named 'jupyter_bokeh'
:DynamicMap   [y_column]

@hoxbro
Copy link
Member Author

hoxbro commented Jan 17, 2023

Try to download jupyter_bokeh either with conda or pip.

And update holoviews to the latest version 1.15.4.

@boustrephon
Copy link

boustrephon commented Jan 17, 2023

Thanks. I had to download jupyter_bokeh from pip as conda didn't have it.

The anaconda channel didn't have 1.15.4, but 1.15.3 worked anyway...

@hoxbro
Copy link
Member Author

hoxbro commented Jan 17, 2023

Glad to hear 👍

The anaconda channel didn't have 1.15.4, but 1.15.3 worked anyway...

Make sense 1.15.4 was released yesterday.

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.

4 participants