Skip to content

Instantly share code, notes, and snippets.

@steelman
Created March 28, 2020 10:47
Show Gist options
  • Save steelman/74849a7a4da5c3177b6ace8640585e86 to your computer and use it in GitHub Desktop.
Save steelman/74849a7a4da5c3177b6ace8640585e86 to your computer and use it in GitHub Desktop.
Time spent looking at exponential graphs (log scale)
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib.dates as md
t0 = pd.Timestamp('2020-01-01')
x = pd.date_range('2020-01-01', '2020-03-31')
y = np.exp(13.815510558/90 * (x-t0).days)
xt = [pd.Timestamp('2020-01-15'),pd.Timestamp('2020-02-15'),pd.Timestamp('2020-03-15')]
with plt.xkcd():
plt.figure()
a = plt.gca()
a.xaxis.set_major_formatter(md.DateFormatter('%B'))
plt.title("Time spent looking at\nexponential graphs (log scale)")
plt.yscale('log')
plt.xticks(xt)
plt.plot(x,y)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment