16

I'm doing a bit of choropleth map plotting in a Jupyter notebook (with Folium), and I was just wondering if there's any way of making an output cell fullscreen? It would just make the map a bit easier to view. If not, is there an easy way of modifying the maximum height of an output cell?

Jason Sundram
  • 12,225
  • 19
  • 71
  • 86
Ned Yoxall
  • 621
  • 1
  • 4
  • 16
  • I think you best bet would be to use a custom jinja2 template and a function that will create the map and a link in the notebook to an html document created with the custom jinja2 template. The jinja2 template could have a 100% width and height map. – kikocorreoso Feb 24 '16 at 09:48
  • You could try to capture the output (plots, maps, table, number, ...) in python, convert it to HTML code, and write it to a new window using javascript. [This strategy works like a charm for Pandas dataframe tables](http://stackoverflow.com/questions/40554839/pop-out-expand-jupyter-cell-to-new-browser-window/40855214#40855214), but I am not sure about plotted maps... – Martin Nov 30 '16 at 01:17

4 Answers4

16

Try this:

    from IPython.core.display import display, HTML
    display(HTML("<style>.container { width:100% !important; }</style>"))
6

I wrote a Jupyter extension that let's a cell go fullscreen here. Installation instructions are on this Github page.

The heart of the extension is just making a selected element (a Jupyter cell) go fullscreen with this code:

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();
    }
  }
}

Please see the Github page for the entirety of the code.

scottlittle
  • 18,866
  • 8
  • 51
  • 70
0

Click F11, to view the Jupyter Notebook in Full Screen Mode. Click F11 once more, to come out of Full Screen Mode.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Aman Burnwal
  • 11
  • 1
  • 2
0

IPython.core.display is deprecated since IPython 7.14

from IPython.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
RedTomato
  • 46
  • 4
  • This answer seems to be building upon Toddneal Stallworth's answer, so it may be more accessible to other users if you edit that post instead. – Score_Under Aug 19 '22 at 17:51
  • I tried @Score_Under, but unfortunately, the suggestion queue is full ... :/ That is why I posted the update as an 'answer.' I'm a StackOverflow newbie. If you have another idea, I will be pleased to try :) – RedTomato Aug 20 '22 at 16:05
  • That's okay, stack overflow is like that sometimes :/ I don't think there's a good solution to that – Score_Under Aug 20 '22 at 21:06