It makes me really annoying that the code cell in the Jupyterlab often scrolls down so that I cannot scroll down to the cell that I want:
So is there a way to stop or shut-off this scrolling within code cell?
Thanks,
I am trying to present a jupyter noteboow following this description:
https://medium.com/learning-machine-learning/present-your-data-science-projects-with-jupyter-slides-75f20735eb0f
I have large plots through which I want to scroll, but the scroll bar does not appear if I run
jupyter nbconvert test.ipynb --to slides --post serve --SlidesExporter.reveal_scroll=True
An MWE would be this cell tagged as a slide:
import matplotlib.pylab as plt
fig = plt.subplots(figsize=(10, 20))
I can zoom out in the browser to view the entire slide, but the slide will remain in the bottom half of the screen.
How can I get scrolling to work nicely?
I am running nbconvert 5.4.0.
Thanks for your help!
I have a large matrix and when I print the matrix in Sage, the Jupyter notebook is wrapping the rows of the matrix, which makes visualizing the matrix very difficult. Instead, I want to enable horizontal scrolling. I've seen various solutions about changing the size of the container window, but this doesn't give me horizontal scrolling.
I have a long Sympy expression that I'd like to get printed with a horizontal scrollbar beneath it. Is it possible to do so in Jupyter? I'm able to toggle vertical scrolling but I want it to be horizontally scrollable instead. The problem with vertical scrolling is that the output of sympy.pretty_print() gets badly distorted in my case. The output also looks ugly and the user has to scroll through the whole output unnecessarily.
Something similar to the np.set_printoptions(linewidth=some_large_number) and/or np.set_printoptions(threshold=some_large_number) approach can be useful but doesn't fix the problem if Jupyter's output window is itself too narrow.
The quickest solution I ended up with is inserting this line somewhere at the top of your notebook:
from IPython.display import display, HTML
display(HTML("<style>pre { white-space: pre !important; }</style>"))
If you want to change this setting for all of your notebooks, you'll need to mess around with the custom.css config file for Jupyter as discussed here.
I wasted too much time figuring this out. Hopefully I can help some of you figure it out quicker!
Iterating on Eric's response slightly, here's a self-contained version that only creates horizontally-scrolling outputs when you want it to, rather than enabling it notebook-wide:
from IPython.display import display, HTML
from pprint import pformat
def boxprint(*args):
for arg in args:
display(HTML('<pre style="white-space: pre !important;">{}</pre>'.format(pformat(arg))))
As written by Eric, changing the white-space property to pre prevents automatic wrapping of output cells, and thus forces an horizontal scrollbar for all wide outputs of the current notebook.
Unfortunately, changing this property also prevents automatic wrapping when editing input cells, which is particularly annoying when editing markdown cells. Even worse: this behavior is not limited to the current notebook, but happens on all open tabs when using JupyterLab, for instance.
The workaround I propose, is to define a function to switch between the standard behavior white-space: pre-wrap and the scrollbar behavior white-space:pre. This simple function does the job:
def hscroll(activate=True):
"""activate/deactivate horizontal scrolling for wide output cells"""
from IPython.display import display, HTML
style = ('pre-wrap','pre')[activate] # select white-space style
display(HTML("<style>pre {white-space: %s !important}</style>" % style))
On hovering right below
out[]:
in notebook you see "scroll output" . On clicking anywhere in that area you get your output scrollable both horizontally and vertically.
I recently started using Atom and try to make it as nice to work with as possible.
However I couldn't figure out how to change the height of the bottom window (a name for it would already help).
My goal is to have my console etc. as minimalistic as possible.
E.g.:
Atom's bottom window shown here with an output example from Atom-Runner
How do I only show the atom-runner's output and not the grey rest of the window on top of it?
How can I get rid of unnecessary labels like "Atom Runner: data.py"?
I found that you can change quite a bit within the styles.less file with commands like:
atom-workspace {
height: calc(...);
}
But that didn't really help me.
However I couldn't figure out how to change the height of the bottom window (a name for it would already help).
atom-runner displays its results in a bottom panel. There are a few different types of containers in the Atom window:
Panes are the content in the middle of the editor. Panes can hold as many items as you want, which are usually associated with a specific file (see TextEditors)
Docks are the expandable areas just outside the panes (the tree-view and github packages use docks). They can have multiple items and will create tabs for them.
Panels are the spaces on the edge of the Atom window. You can't hide them without disabling the whole package.
How do I only show the atom-runner's output and not the grey rest of the window on top of it?
The "grey rest of the window" is the bottom dock. You can hide it by clicking on the semicircle with the down arrow.
How can I get rid of unnecessary labels like "Atom Runner: data.py"?
I disagree that it's unnecessary, and you might some day find that you need to know what file you ran. However, if you want to do this, you can add the following to your styles.less:
.atom-runner h1 {
display: none;
}