Created
March 28, 2020 10:47
-
-
Save steelman/74849a7a4da5c3177b6ace8640585e86 to your computer and use it in GitHub Desktop.
Time spent looking at exponential graphs (log scale)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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