[英]Making a Jupyter notebook output cell fullscreen
我在 Jupyter 笔记本(使用 Folium)中做了一些 choropleth map 绘图,我只是想知道是否有任何方法可以制作 output 单元全屏? 它只会使 map 更容易查看。 如果没有,是否有一种简单的方法可以修改 output 单元的最大高度?
尝试这个:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
我写了一个 Jupyter 扩展,让我们在这里全屏显示一个单元格。 安装说明在此 Github 页面上。
扩展的核心只是使用以下代码使选定元素(Jupyter 单元格)全屏显示:
function toggleFullscreen(elem) { //function to make element (cell) fullscreen on most browsers
elem = elem || document.documentElement;
if (!document.fullscreenElement && !document.mozFullScreenElement &&
!document.webkitFullscreenElement && !document.msFullscreenElement) {
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
}
有关完整代码,请参阅 Github 页面。
IPython.core.display 自 IPython 7.14 起已弃用
from IPython.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
单击 F11,以全屏模式查看 Jupyter Notebook。 再次单击 F11,退出全屏模式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.