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

Support for colaboratory #77

Open
langley opened this issue Apr 25, 2019 · 2 comments
Open

Support for colaboratory #77

langley opened this issue Apr 25, 2019 · 2 comments

Comments

@langley
Copy link

langley commented Apr 25, 2019

I tried uploading the plotly-scala.ipynb from almond.sh examples to colaboratory.

I got it to run but I don't get any plots in the browser.

I've seen some comments about something similar for python in SO.

@langley
Copy link
Author

langley commented Apr 27, 2019

Found out that if I add this to a cell plotly renders!

    kernel.publish.html("""
       <script src="/static/components/requirejs/require.js"></script>
       <script>
         requirejs.config({
            paths: {
            base: '/static/base',
            plotly: 'https://cdn.plot.ly/plotly-latest.min.js?noext',
              },
         });
       </script>""")

Now... on to figuring out how to make this easy or automatic!

This SO article talks about registering pre_run_cell logic for the python solution to the problem.
IPython.get_ipython().events.register('pre_run_cell', configure_plotly_browser_state)

@sbrunk
Copy link
Collaborator

sbrunk commented Apr 27, 2019

The almond module actually does something similar to inject plotly.js into Jupyter classic:

s"""require.config({
| paths: {
| d3: 'https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min',
| plotly: 'https://cdn.plot.ly/plotly-${Plotly.plotlyVersion}.min',
| jquery: 'https://code.jquery.com/jquery-3.3.1.min'
| },
|
| shim: {
| plotly: {
| deps: ['d3', 'jquery'],
| exports: 'plotly'
| }
| }
|});

If we're able to detect that we're running on colab somehow, we could adapt that logic.

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