Ho to set up Jupyter notebook default folder in Anaconda

I have two laptops with Anaconda installed on both and I had some issues to find a working solution to configure the start in folder of Jupyther so I though it’d be a good idea to post the two solutions that worked for me.

Using PowerShell command

Open the windows powershell prompt or the powershell Anaconda prompt and type the following:

 jupyter notebook --generate-config 

This will generate a file to your user default directory: C:\Users\username\.jupyter\jupyter_notebook_config.py

CaptureThen open this file in any Editor and search for the following line: “c.NotebookApp.notebook_dir”
Make sure to remove the hash mark # before and replace the line by by c.NotebookApp.notebook_dir = 'Disk:\\your\\desired\\working\\directory'
Now save an close the file.

 

Your Jupyter notebook should now start in your desired folder, if not  bear with me you can try this second method.

Using windows graphical mode

  • Click on Windows start menu and find you Jupyter Notebook application
  • Right click on Jupyter and click on open file location

Capture

  • Then right click on your jupyter notebook shortcut
    • Click on Properties
    • In the start in box enter your desired path
    • Check in the target box that you do not pass any argument otherwise  you’ll override the Start in path

Capture

 

 

 

How to change the size of Plot Figure Matplotlib

 

When plotting figures with  matplotlib  you might want to reduce or increase the size of the figure displayed.

So here is a quick trick to adjust the size

import matplotlib.pyplot as plt
#Inside your plot code just type the following line of code
#Set the plot width to 12 inches and height to 6 inches
plt.rcParams["figure.figsize"] = [12,6]

For more details see the  figure  documentation .