Is it possible to generate interactive plotly visualizations in the jupyter notebooks on the RAP? I can load the plotly package and can execute the code but I just see a blank where the visualizations should be.

Comments

1 comment

  • Comment author
    Ondrej Klempir DNAnexus Team

    The following steps worked on my side:

     

    A) First go to the notebook and install plotly dependencies, including dependencies for JupyterLab:

     

    %%bash

    pip install plotly==5.14.1

    pip install "jupyterlab>=3" "ipywidgets>=7.6"

    pip install jupyter-dash

     

    2) Go to Terminal and execute the following commands to install additional JupyterLab extensions:

     

    jupyter labextension install plotlywidget

    jupyter labextension list

    jupyter lab build

     

    Note: I faced several error messages during this step, so maybe some of the commands are not necessarily.

     

    3) Go back to a notebook cell, and paste:

     

    import plotly.io as pio

    pio.renderers.default = "iframe"

     

    4) I tested the all steps above with the following:

     

    import plotly.express as px

    fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])

    fig.show()

     

    Screenshot 2023-06-08 at 9.41.445) I would recommend then creating/saving a snapshot, so your JupyterLab env can be reused in your future session and you do not need to install plotly again.

    0

Please sign in to leave a comment.