University of South Florida workshop
Tuesday, February 27th, 2024
9:00 - 10:30 am EST
This workshop will introduce the basics of the powerful Python data visualization library Matplotlib. We will create simple visualizations for different types of data and explore how to customize and share these visualizations. This is a follow-up workshop to the Python Programming: An Introduction workshop, you can find the material HERE.
We will be using real data taken from the Gapminder dataset. To download the data, click
HERE to go to the file webpage. Click on the download
button, unzip the file, and place the unzipped folder named data on your desktop.
We will program in Python using JupyterLab, a programming environment that runs in a web browser. For this to work you will need a reasonably up-to-date web browser -- Chrome, Safari and Firefox are all supported.
You will also need to find the command line (aka terminal, shell) on your system. If you are not familiar with the command line on your system, you can find help HERE.
To start the software, you will need to use your terminal to open a notebook. In your terminal type jupyter notebook
- your terminal will fill with code and a new browser window will open with the Jupyter software. Click on New
and Python3
, and you are all ready to code in a new notebook! For more information about getting started, HERE is a helpful document.
Downloading Python and JupyterLab independently may often times run into issues that are tricky and time consuming to resolve. A simpler method of obtaining Python is to use the all-in-one installer Anaconda. It easy to install, provides a user-friendly interface, and allows easy access to Python packages.
Download Anaconda - https://www.anaconda.com/products/individual
Addition Help with Anaconda - HERE
For advanced users that are familiar with the command line and prefer to install Python and JupyterLab individually, you can find the links and installation instructions on the software websites linked below.
There are two current versions of Python -- we will be using version 3.5 or later.
Download Python 3.x - https://www.python.org/downloads/
Install JupyterLab by following the first set of instructions - https://jupyter.org/jnstall
We will be using the Python plotting package, Matplotlib. It must be installed on your computer using the command line using the command pip
.
- Getting started with
pip
instructions- Note: You may need to use
python3
instead ofpython
like the instructions indicate - Note: You may also need to use
pip3
instead ofpip
- Note: You may need to use
- If
pip
is not installed or working, try following these instructions HERE
- On command line, type:
python -m pip install -U pip
python -m pip install -U matplotlib
- Installation instuctions for Matplotlib - HERE
- On command line, type:
pip install numpy
- Installation instructions for Numpy - HERE
- On command line, type:
pip install pandas
- Installation instructions for Pandas HERE
- Beginner's Guide to Python - Official Python with extensive resources
- A helpful document with Python basics to reference: DataCamp Python Basics Cheat Sheet
- A tutorial demonstrating how to use Matplotlib with real data: DataCamp Introduction to Plotting with Matplotlib in Python
- Matplotlib documentation
- Colors in Matplotlib - Named Colors
- Style guide for python code - PEP 8
- The Zen of Python - PEP 20
- The Carpentries