jupyter-widgets / jupyterlab-sidecar

A sidecar output widget for JupyterLab
BSD 3-Clause "New" or "Revised" License
252 stars 39 forks source link

Add anchor attribute to choose between right sidebar or main area #8

Closed fcollonval closed 3 years ago

fcollonval commented 6 years ago

We are using a lot bokeh for plots. Unfortunately in JupyterLab cloning the output view into a separate widgets is not working as expected. In particular when using push_notebook, only the view in the notebook is updated not the other view. So your sidecar project is really interesting. But to have a more flexible layout, I added an attribute anchor that can be right or main depending if the user wants the output in the right sidebar or in the main area.

I also try to add the widget in the left sidebar. But in such case, the tab is non closable (I did not figure out why).

As a side note, I think an option like anchor could be a nice to have in the standard Output widget (in the context of JupyterLab).

jasongrout commented 6 years ago

What is push_notebook? Is it something that should be fixed somewhere, to have the view updated?

fcollonval commented 6 years ago

Yes, Bokeh is not playing as nicely as bqplot or plotly.py 3.0. To update a previously created plot, you need to explicitly push the new properties through a handle.

Here is the relevant documentation.

So you are right. The view update process should be fixed in bokeh. So I have opened an issue there.

Nota: I still think the ability to directly redirect the output in an side widget is interesting in the case where the same figure will be updated along side the execution of a notebook. It such case, updating the "regular" output in the notebook may even be a waste of ressources if it is hidden.

phausamann commented 6 years ago

Are there any plans to merge this PR? I have a similar use case with bokeh, large plots that I'd prefer to show in a separate tab rather than inline.

ianhi commented 4 years ago

Other than a rebase is there anything holding back this PR? It adds some really nice functionality to this extension.

The one thing is that maybe the example shouldn't use plotly as not everyone will have installed

jasongrout commented 4 years ago

Other than a rebase is there anything holding back this PR? It adds some really nice functionality to this extension.

I've added a few comments.

Note that you can also right click on any output and select "Create new view for output" to get a tab with that output. It won't be programmatic, but it will be a tab in the main area.

jasongrout commented 4 years ago

As a side note, I think an option like anchor could be a nice to have in the standard Output widget (in the context of JupyterLab).

Unfortunately, that would make the output widget very specific to JupyterLab.

fcollonval commented 4 years ago

Thanks for the review @jasongrout

I rebased this PR and made the modifications.

fcollonval commented 4 years ago

This should be good to go.

ianhi commented 3 years ago

Hi @fcollonval would you mind rebasing one final time?

fcollonval commented 3 years ago

Hi @fcollonval would you mind rebasing one final time?

Done

jasongrout commented 3 years ago

I can't merge stuff here otherwise I would deal with this

Fixed! You can do stuff here too.

ianhi commented 3 years ago

Thanks @fcollonval !

(And thanks jason for fixing merging rights :smile: )