I made a notebook in VSC with some plotly histograms. They show up in VSC under the cell as expected. However when I convert to html with jupyter nbconvert --to html --no-input main.ipynb
and then load the html file in my browser, those graphs don’t show up. There is a missing place where they should be. I can see the div in the inspect window but they’re just blank space. In the console I see
file:///C:/localpath/plotly.js net::ERR_FILE_NOT_FOUND
which is deriving from (among others)
h.load @ require.min.js:34
The require.min.js
is from https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js
I tried manually adding <script src="https://cdn.plot.ly/plotly-2.18.0.min.js"></script>
to the html file after the title but before the <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
.
I can see in my network activity that it downloads that js file but then it still tries to download the local version. I searched the html file and there’s no direct reference to plotly.js so it seems it’s some interaction with that require.js
If I manually download https://cdn.plot.ly/plotly-2.18.0.min.js
and save it to the same directory as the html file and rename it to plotly.js then it works but I don’t want to have to do that because then it makes sharing the html file extra cumbersome.
How do I get the html file from my notebook to load the remote plotly.js instead of insisting on it coming from a local file at the same relative path?