Skip to content

Instantly share code, notes, and snippets.

@magsol
Created October 4, 2023 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magsol/0d204b27dc49f9748db19f923f8f8763 to your computer and use it in GitHub Desktop.
Save magsol/0d204b27dc49f9748db19f923f8f8763 to your computer and use it in GitHub Desktop.
Monthly running mileage plot
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
# Dates (by month: October 2019 through September 2023)
dates = ['Oct19', 'Nov19', 'Dec19', 'Jan20', 'Feb20', 'Mar20', 'Apr20', 'May20', 'Jun20', 'Jul20', 'Aug20', 'Sep20', 'Oct20', 'Nov20', 'Dec20', 'Jan21', 'Feb21', 'Mar21', 'Apr21', 'May21', 'Jun21', 'Jul21', 'Aug21', 'Sep21', 'Oct21', 'Nov21', 'Dec21', 'Jan22', 'Feb22', 'Mar22', 'Apr22', 'May22', 'Jun22', 'Jul22', 'Aug22', 'Sep22', 'Oct22', 'Nov22', 'Dec22', 'Jan23', 'Feb23', 'Mar23', 'Apr23', 'May23', 'Jun23', 'Jul23', 'Aug23', 'Sep23']
# Mileages (per month)
mileages = [153.49, 100.30, 101.19, 80.82, 139.45, 125.23, 101.14, 97.93, 82.42, 49.97, 0.0, 0.0, 23.76, 8.41, 5.68, 33.96, 14.08, 17.80, 30.97, 40.24, 16.40, 29.37, 23.41, 30.10, 35.08, 18.06, 18.79, 52.87, 33.71, 58.27, 21.67, 25.81, 14.68, 16.24, 38.55, 41.04, 50.35, 8.96, 15.77, 14.19, 48.73, 64.55, 73.92, 63.36, 60.10, 62.67, 85.22, 101.28]
# Plotting!
plt.plot(mileages, '.-')
plt.title("Monthly Mileage")
plt.xticks(np.arange(len(dates))[::4], dates[::4], rotation = 30)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment