In this article, I will discuss some visual settings and other general recommendations I have for setting up your Jupyter Notebook.
Before embarking on my journey in the world of Data Science, I was a software developer working on a variety of technologies in the mobile space. Unfortunately for me, this meant I had to set up many different IDEs and other environments that were required for the tasks I needed to complete. Immediately upon installation, I would always make sure to change the “Theme”. I’m not typically a person who is obsessed with making sure all the aesthetics of something look perfect; however, one month’s work within Xcode and its default settings is all it took for my tired eyes to tell me “I can’t continue working like this”. Something I can’t stand is how nearly every development application always defaults to a “Light Mode” equivalent, when the primary users are developers spending long hours looking at a very bright, white background. Beginning my work within a Python environment was no exception to this. I’d like to pass on to you my own settings that I found for a Jupyter Notebook environment in hopes that I can save you some time, as well as your own eyes in the long run.
I highly recommend using a package called “jupyterthemes”. Not only does this give you some quick and easy theme options, but it also gives you the customization freedom to tweak any other visual elements to your preference.
I’m not going to go over in-depth how to go through the initial setup for the installation of Python and Anaconda. The following instructions only apply if you’re able to actively run a Jupyter Notebook on your local machine. I will, however, go over the installation of jupyterthemes. And this is the first step! You’re welcome to follow along with the documentation here, but I will be highlighting the parts that were most important for me.
From the command line:
pip install jupyterthemes
Simply wait for this process to complete. Easy. Now comes the fun part. I know everyone’s preferences are different, but I’ll run you through the setup I use on any new device while using Python. Here it is:
jt -t onedork -fs 95 -altp -tfs 11 -nfs 115 -cellw 65% -T -N -altmd
This command might look confusing to a new user, but I’ll go over each of the important settings in this single line. Hopefully, you’re already much happier with this more classic-looking dark theme for your notebook. It is worth noting that you may need to restart or refresh your notebook in order for these changes to be applied. Let’s look through these settings briefly, as the documentation for each of these is not very verbose.
This is simply our setting for the “onedork” theme. This is my personal favorite, but other options include grade3, oceans16, chesterish, monokai, solarized1, and solarizedd. You can preview these with your own “jt -t” commands or viewing previews of each uploaded here.
This is the Font Size. I generally don’t like my font to be very large, and this setting makes the font slightly smaller than default to show slightly more code on the screen at a time. The value 95 translates to 95% of the default size.
This is the “alternate prompt layout”. This essentially makes leaves a narrower layout and excludes line numbers. Typically, I like my notebook looking as clean as possible when showing it to someone, and this setting reduces a little bit of that clutter.
This is the font size for text within Markdown cells, slightly smaller than the default.
This is the font size of the actual settings within the notebook. Namely, “File”, “Kernel” and other options at the static top of the page. 115 is equivalent to 115% of it’s default size.
This is the “cell width”. I have this option set to 65% so that the cell will essentially extend outward from the center, covering 65% of the width of the window. I like this value, because at higher values for this setting, our code is not as “centered”.
-T -N -altmd
These are the settings to toggle the toolbar, name and logo of the notebook, and the color of the markdown. For this alt markdown toggle setting, the markdown color blends into the color of the actual notebook. I like this setting because it highlights the focus on the actual code in the notebook and the markdown ends up looking cleaner as a result.
I hope this helps you save some time from trying out all of these settings yourself, or at the very least gives you a solid visual option for working within a Jupyter Notebook for many hours at a time. However, I know that if you’re a developer, you’re probably going to want to try EVERY option at your disposal. If that’s your thing, check out the jupyterthemes documentation at https://github.com/dunovank/jupyter-themes to find your perfect settings.