Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Installation and Setup

00:00 Time to get set up to get started with the tutorial. I will be using the Anaconda Python distribution throughout this tutorial, but I’m also going to show you in this video how to do it both with Anaconda or just with plain Python.

00:15 So first, if you want to use Anaconda, you will have to head over to their website and download an installer. You can get one for Windows, macOS, or Linux. Just choose your platform, download the appropriate installer, and follow the installation instructions.

00:29 Once you’re done with this, you can go to your terminal and then you can create a new conda environment. You can do that by saying conda create and then --name and then you can give the environment a name.

00:43 I would call it plotnine, but that’s just a name, so you could use anything else as well. Press Enter, and then agree that it should be installing all of this stuff.

00:56 So, the environment has been created. Now I can activate it and I can do this by running the command conda activate and the name of the environment. So we’ll say conda activate plotnine.

01:10 And once you see this prompt here on the side, before your prompt, the plotnine name of your environment, then you’re inside of the environment, and then you can install the packages that you need for this course.

01:23 Those are going to be just two. You’re going to need plotnine and Jupyter Notebooks, so you can say conda install plotnine and jupyter, press Enter, and then just wait for this installation to complete.

01:38 It’s going to download a bunch of stuff. Oh, I will have to say yes, ha, and then you see that it starts downloading all of the packages that it needs. Those are some dependencies for either Jupyter Notebooks or for plotnine.

01:54 You will see that there’s a bunch of popular Python libraries like SciPy or pandas that are going to get installed as well because plotnine nine actually relies on a lot of these things and does it’s plotting based on a mixture of pandas and Matplotlib, but abstracts on top of that.

02:13 So, the installation is done. You might see a bit more because I’ve done this before, I’ve downloaded some of the libraries before, so it didn’t have to download everything.

02:22 But once it tells you done and brings back the prompt, then you’re good, and then you’re ready to get started if you want to do it with the Anaconda distribution. Now, let me deactivate this and show you how to do it without Anaconda.

02:41 So, if you want to use the built-in Python virtual environment module, then you need to follow a similar process. You don’t need to download Anaconda, and then you just need to create a virtual environment using the venv module and then you also need to activate it and install plotnine.

02:58 So, let’s look at this in the terminal. First, I need to create the virtual environment, which I will do with the saying python -m venv, use the venv module, and create a virtual environment in a folder called venv.

03:14 You can also give it a name. You can say --prompt and then give it a name just like you did with the conda environment. I’m going to call this one also plotnine, press Enter, and then wait for this to complete, which was pretty quick.

03:28 And then I also need to activate it, so I’m going to say source, go to this folder, bin/ folder, and the activate script.

03:35 And when I execute this activate script, then the virtual environment has been activated. Now, once you see this here on the side, you can go ahead and say pip install plotnine and jupyter, press Enter, and again, you’re just now going to have to wait for this installation to complete, and then you’re ready to go.

04:01 I’m not going to wait this out now because I’m going to be using Anaconda, but with running these commands in an activated version environment, you’re going to be set up to get started working on this just as well as you would with Anaconda.

04:16 Once all your installations are complete, you can create a new folder for your project. So let’s mkdir, inside of Documents/ I’m going to make a new folder called plotnine, and then I’m also going to move there.

04:37 Okay, and I have a new empty folder called plotnine. Inside of here, I’m going to start the Jupyter Notebook.

04:48 Now, once the server is up and running, your browser will bring up an empty site that looks approximately like this. In here, you can create a new Python 3 Notebook by clicking on New and then Python 3.

05:07 Once you’re here, you’re ready to get started with the first lesson.

05:12 And that’s all about the setup. In the next lesson, you’re going to start looking at the first layer of the grammar of graphics: the data layer. You’ll learn about it at hands [sic] of running through a couple of examples in a Jupyter Notebook.

Become a Member to join the conversation.