Skip to content

Latest commit

 

History

History
97 lines (67 loc) · 4.25 KB

File metadata and controls

97 lines (67 loc) · 4.25 KB

Assignment — Altair & JupyterLab Setup

​ This repository is your starting point for the assignment and includes the instructions below.

Aim of the assignment

Altair is a declarative statistical visualization library for Python, based on Vega and Vega-Lite. We will use it in class so we want to get set up with it on your laptop.

If you run into problems see the Tips, tricks, and troubleshooting section below.

Instructions

Setup instructions

  1. Clone the repo.

  2. CD to the repo directory. Create and activate a virtual environment for this project. You may need to modify the code you use depending on what Python you have installed and how your machine is configured.

  3. Run the setup commands below.

    • On macOS or Linux, run these three commands separately in case there are errors:
      python3 -m venv env
      
      source env/bin/activate
      
      which python
      
    • On Windows, run these three commands separately in case there are errors:
      python -m venv env
      
      .\env\Scripts\activate.bat
      
      where.exe python
      

    Check the path(s) provided by which python or where.exe python — the first one listed should be inside the env folder you just created.

  4. Install necessary packages. Note that you should install the exact versions of the packages.

    pip install -r requirements.txt
    

    This may take a few minutes.

If you have trouble running any of these steps, see the Troubleshooting section below.

Run instructions

  1. Run jupyter lab. It should open your default browser and let you select select any Jupyter Notebook .ipynb file.

  2. Open notebook.ipynb.

  3. Run individual cells with ctrl+enter. In the menu you can run all cells and restart the kernel to clear variables.

  4. Make sure there are not any errors! If there are errors, troubleshoot them ASAP as they could prevent you from participating in the in-class Altair tutorial & assignment. ​

Save the visualization as a PNG & commit it

  1. Save the image as a PNG named visualization.png.

    Note that Altair lets you save a PNG file directly using the ⋯ menu in the top-right of a visualization.

Quit instructions

  1. Make sure to save your .ipynb file and shutdown Jupyter Lab properly through the file menu. Otherwise you need to use jupyter notebook stop. ​
  2. Deactivate the venv to return to your terminal using deactivate.

Commit and push your code (but first...)

  1. Only if you have made any changes to the required packages you should export a list of all installed packages and their versions:

    pip freeze > requirements.txt
    
  2. Before you commit a Jupyter Notebook .ipynb file, clear the outputs of all cells. This decreases file size, removes unnecessary metadata, and makes diffs easier to understand. In Jupyter Lab you can use the GUI: Edit->Clear All Outputs.

  3. Make sure to add all your required files, including the visualization.png image you saved.

  4. Finally, commit all your local files and push them to the remote repository on GitHub which was generated by GitHub Classroom.

Submission instructions

  1. Ensure that visualization.png you saved is pushed to the remote repository on GitHub which was generated by GitHub Classroom. We will grade based on what is available in that repository.

  2. Submit the URL of your GitHub Classroom-generated repository (not a GitHub Page — we're not using it for this assignment anyway) to the associated assignment on Canvas. Do not submit a link to a personal repository. It must be within our class GitHub organization.

Tips, tricks, and troubleshooting

See https://github.com/NEU-DS-4200-F20-Staff/General_Course_Information/blob/master/altair.md

Assignment setup (for instructors only)

See https://github.com/NEU-DS-4200-F20-Staff/General_Course_Information/blob/master/assignment-setup.md