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

unable saving interactive heatmap plot in to html file #97

Open
TalWac opened this issue Jul 14, 2021 · 10 comments
Open

unable saving interactive heatmap plot in to html file #97

TalWac opened this issue Jul 14, 2021 · 10 comments

Comments

@TalWac
Copy link

TalWac commented Jul 14, 2021

Dear Developers,

I'm trying to save the interactive heatmap plot into an HTML file without success so it can be served as a report file.
followed the instruction to Sharing with nbviewer

To Reproduce
Steps to reproduce the behavior:

  1. I check I have ipywidgets version 6 or later
  2. used the “Save Notebook with Widgets” action in the Widgets menu in the Jupyter.
  3. Uploaded the notebook to my github my repo and the environment.yml file
  4. copied the link of my notebook to the nbviewr
  5. clicked on Execute on Binder

Expected behavior
to be able to download the interactive heatmap plot the HTML file.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: chrome
  • Version [e.g. 22]

Additional context
I'm not sure if I was doing the correct steps or if I provided enough details.
If there more info needed please tell me

This is a link to the notebook on Github

Any hint \ idea will be welcome

Many thanks for your help!

@cornhundred
Copy link
Contributor

Yes, it is possible but using the latest version of Widgets I've only been able to do this using nbconvert on the terminal "jupyter nbconvert --to html my-notebook.ipynb"

@TalWac
Copy link
Author

TalWac commented Jul 18, 2021

@cornhundred - Thank you for answering, much appreciated!

it is possible but using the latest version of Widgets

I have the ipywidgets package version 7.6.3 installed and downloaded in the script - Is this what meant?

If so, is there anything else that needs to be done in the script ( since it still does not display me the interactive heatmap?

Many Thanks,
Tal

@TalWac
Copy link
Author

TalWac commented Aug 1, 2021

Are there any more ideas on how to make interactive heatmap work with clustergrammer2 on an HTML file?
I just do not know what am I doing wrong

@cornhundred
Copy link
Contributor

cornhundred commented Aug 1, 2021

Hi @TalWac you have to run the nbconvert command in a terminal outside of Jupyter. They may have also fixed this functionality in Jupyter Lab 3 - I'll check and update

@TalWac
Copy link
Author

TalWac commented Aug 2, 2021

Hi @cornhundred thank you for answering!- I did run the nbconvert command in the terminal and an HTML was created but without the part of the clustergrammer2 ( the interactive heatmap)

@cornhundred
Copy link
Contributor

Ok, I forgot if you are running the normal Jupyter notebook (not Lab) you will also need to tell Jupyter to save the widget state after the notebook has run using the drop down described here https://clustergrammer.readthedocs.io/clustergrammer_widget.html?highlight=Save#sharing-with-nbviewer

Or a more updated version here

https://ipywidgets.readthedocs.io/en/latest/embedding.html#save-notebook-widget-state

If you are running Jupyter Lab you can tell it to aromatically save widget state.

@TalWac
Copy link
Author

TalWac commented Aug 3, 2021

I did follow the steps to tell Jupyter to save the widget state using the dropdown.
But, sill, I receive an HTML file without the interactive heatmap

@cornhundred
Copy link
Contributor

Hi @TalWac that is odd. Another option is to use papermill https://papermill.readthedocs.io/en/latest/ to run your notebook. This approach has worked well for me in the past and should automatically embed widget data into the saved notebook - then you have to run nbconvert on the output notebook. I can provide more details if you run into issues.

@TalWac
Copy link
Author

TalWac commented Aug 3, 2021

Thank you @cornhundred very much for your time and effort!
I'll check the papermill and update if any issues appears

@TalWac
Copy link
Author

TalWac commented Sep 2, 2021

Dear - @cornhundred - still it seems I'm doing something wrong. but I can not figure what

These are the steps I made the use of the papermill :

  1. Installing the papermill
    conda install -c conda-forge papermill

  2. Executing as written in the link Execute via the Python API:

    import papermill as pm

    pm.execute_notebook( 'D:/path/to/notebook//Report-notbook.ipynb', 'D:/path/to/notebook/to /be/created/Report-notbook-out.ipynb' )

  3. Then in the command line
    jupyter nbconvert --to html Report-notbook-out.ipynb.ipynb

However, the HTML file created has no interactive heatmap in it

Also tried to run the notebook using JupyterLab- but doing so, I was not able to plot the heatmap at all. only received the icon Loading widget...

Kindly your advice
Regards

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

2 participants