I'm trying to wrap my head around messaging in Jupyter notebooks. But I'm a bit lost and confused.
My goal is fairly straight forward to state: I want my python kernel to update the output of a cell in a Jupyter notebook while a long calculation is running. Whenever new data arrives in the browser, I want to trigger a redraw by calling some javascript function.
Specifically, the cell output contains HTML with a WebGL canvas. That part works well. I can easily visualize the initial data in the canvas with WebGL/javascript. But I want to update the data dynamically, as the kernel performs a long calculation on it. What I'd like to know is how one of my javascript functions in a notebook can receive binary data from my kernel.
I tried to read the documentation on messaging and jupyter notebooks, but it's really short and doesn't provide any links for further reading. What would really help is an example in the form of two code snippets, one for the notebook and the other for the kernel side.
Related
I would like to add some simple actions that should be done automatically each time I execute the cell or save the notebook. Let's imagine I want to make a log of some of my activities in notebook (ipynb, the json) metadata.
For example, let's image I want to do following:
each time I run cell I want to store such information in metadata so I will know exactly when and which cell I executed,
after each notebook save (Ctrl+S) I want to perform some postprocessing and generate some report,
after each copy/paste (Ctrl+C/Ctrl+V) I want to check the clipboard and process it.
Is it possible to somehow implement it in Jupyter Notebook? I need it to be embedded to notebook file (not as external extension that user need to install and turn on).
When using Jupyter Notebooks within VS Code is it possible to stop the code cell result text from wrapping?
When querying wide dataframes (Eg 100 columns wide) the resulting text is unreadable due to the text wrapping and requires copying out to other text editors to be able to read the results.
Attached is a screenshot of a simple dataframe header that is wrapping over a couple of lines, once you're returning actual rows it's unusable.
Screenshot
This could be a limitation of Jupyter's UI. I recommend you to see your data in variable explorer and data viewer. By clicking theĀ VariablesĀ icon in the top side after running, you'll see a list of the current variables. For additional information of the variables, you can double-click on a row or use the Show variable in data viewer button to see a more detailed view.
I'm new to the Jupyter notebook. When I am moving to the dashboard grid layout, all off my cells are stack upon each other without any option of moving them. In addition, I can't go back to regular notebook view without reentering the notebook.
I've tried to play with the settings without success. Then I switched all my code to just 2 simple headings and it is still happening. Couldn't find any answers on the web.
Anyone has an idea how to solve it?
I often write functions that print a lot, say every 100th go-around a long loop, which in the Terminal run fine, because my screen auto-scrolls down with the output; but on Jupyter, the output quickly moves downward, and I have to scroll down myself to keep up with it. This happens whether I'm in the "enable scrolling" or "disable scrolling" for the output.
So, my Q is: Is there a way to have Jupyter auto-scroll down with the output? I suppose this would make more sense inside of a scroll window (i.e. "enable scrolling".) Auto-scrolled output would give a more Terminal-like experience, which I am much more familiar and comfortable with. (And, to be honest, I also miss my The-Matrix-like aesthetic of streaming output.)
If it matters, I use Jupyter Lab primarily, but I believe the same is true on Jupyter Notebook.
Thanks so much, all!
nbextensions has an auto-scroll extension to do just that, though its incompatible with jupyter lab at the moment.
https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/autoscroll/README.html
When using the web based iPython Notebook/Jupyter capability, i created a notebook with markdown cells of text and code cells to display the code and plots for matplotlib and bokeh. I then download that as .ipynb open with sublime, copy and paste to git, then access it on nbviewer through my git account. When looking at it here:
http://nbviewer.ipython.org/github/angisgrate/test/blob/master/pyohio3.ipynb
in notebook view, it works fine. the markdown, code, and plot steps are all there.
When switching to slides view, the intent of the creation needed for the presentation, this code blocks occurs first, blocking out the first 10 markdown steps and all the matplotlib steps, rendering this weird code without the plots:
http://nbviewer.ipython.org/format/slides/github/angisgrate/test/blob/master/pyohio3.ipynb
How can i fix this asap?? I've looked through and there was a similar problem in 2014 with slides, but it yielded an actual "Error" that i'm not seeing, just this contorted view
I can't say for certain. It's possible in the nbviewer slides view, the execution of JavaScript is suppressed (this happens on GitHub notebook previews, for instance). All of the rendering in Bokeh actually happens from the JavaScript library BokehJS, so if this is the case, then Bokeh will not function, and there is nothing really that can be done. This is probably a question bset directed towards the nbviewer team/community to find out the specifics of how the slides view behaves (and is intended to behave) with respect to executing embedded JavaScript.
Edit: Looks like this is a known/discussed issue. More information here: Issue #484: Jupyter>>nbviewer slides Fail, notebook view fine by angisgrate in jupyter/nbviewer on GitHub