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

automatic VegaLite display in jupyterHub #12

Open
DougBurke opened this issue Mar 1, 2019 · 1 comment
Open

automatic VegaLite display in jupyterHub #12

DougBurke opened this issue Mar 1, 2019 · 1 comment

Comments

@DougBurke
Copy link
Owner

This should be packed up into ihaskell-hvega but I'm not sure how to handle the difference between using in Jupyter notebooks and Jupyter lab, so probably just a different module for now - but if you have a VegaLite visualization created with toVegaLite , then you can

import qualified IHaskell.Display as IHD
import qualified Data.Text.Lazy as LT
import Data.Aeson.Text (encodeToLazyText)

instance IHD.IHaskellDisplay VegaLite where
    display vl =
        let js = LT.unpack (encodeToLazyText (fromVL vl))
        in pure (IHD.Display [IHD.vegalite js])

after which you should see the visualization automatically in JupyterLab:

vegalite

So I suggest you go over to https://github.com/tweag/jupyterWith and try it out.

@DougBurke
Copy link
Owner Author

I've updated ihaskell-hvega to support this - but it's complicated due to supporting both old (notebook) and new (lab).

There's a new notebook - https://github.com/DougBurke/hvega/blob/master/notebooks/vegalite.ipynb - and a shell.nix file in that directory which lets you use jupyterWIth from tweag

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