This repository hosts scripts related to data visualization in Python.
Code: line_plot.py
Data: data/city_weather_2019.csv
Modules: pandas
, matplotlib
Description: This script generates a line plot of weather across days of the year for two separate cities. The script also provides good examples of pandas
functionality, particularly string manipulation (for dates). In the second plot below, I used df.rolling(5).mean()
to apply a 5-step moving average to both curves.
Video Tutorial: https://youtu.be/cWXnPYJGe4g
Code: scatter_plot.py
Data: mtcars.csv (loaded from https://gist.github.com/ZeccaLehn/4e06d2575eb9589dbe8c365d61cb056c)
Modules: pandas
, numpy
, matplotlib
Description: This script generates a scatter plot of MPG vs HP from the mtcars dataset. The script also provides good examples of text manipulation on the plot (e.g., font style, weight, color, and padding). The script also provides a numpy
template for adding a line of best fit (1st order ploynomial) to the scatter data.
Video Tutorial: https://youtu.be/6V23myHGdng
Code: bar_plot.py
Data: mtcars.csv (loaded from https://gist.github.com/ZeccaLehn/4e06d2575eb9589dbe8c365d61cb056c)
Modules: pandas
, numpy
, matplotlib
Description: This script generates two bar plots - one of MPG vs cylinder count and one of multiple variables grouped by cyclinder count. All data comes from the mtcars dataset. The script also provides good examples of common pandas
functionality (e.g., .mean()
, .std()
, and .groupby()
).
Video Tutorials:
Code: box_plot.py
Data: mtcars.csv (loaded from https://gist.github.com/ZeccaLehn/4e06d2575eb9589dbe8c365d61cb056c) and iris (loaded from Seaborn)
Modules: pandas
, matplotlib
, seaborn
Description: This script generates two box plots - one of MPG vs cylinder count (from the mtcars data set) and one of sepal width as a function of plant species and sepal length (from the iris data set). The script incoporates functions from the seaborn
module.
Code: cormat_plot.py
Data: mtcars.csv (loaded from https://gist.github.com/ZeccaLehn/4e06d2575eb9589dbe8c365d61cb056c)
Modules: pandas
, numpy
, matplotlib
, seaborn
Description: This script generates a heat mapped correlation matrix from the mtcars data set.
Code: histogram_plot.py
Data: mtcars.csv (loaded from https://gist.github.com/ZeccaLehn/4e06d2575eb9589dbe8c365d61cb056c)
Modules: pandas
, matplotlib
, seaborn
Description: This script generates example histograms using the mtcars data set.
Code: joint_plot.py
Data: iris (loaded from Seaborn)
Modules: matplotlib
, seaborn
Description: This script generates examples of joint plots, which have a main, center panel and marginal panels.