-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
38 lines (27 loc) · 860 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import streamlit as st
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set()
sns.dark_palette("#69d", reverse=True, as_cmap=True)
st.markdown("# Atomic Habits Compounding Effect")
x = st.slider('% Betterment', min_value=0.0, max_value=6.0, step=0.5)
y = st.slider('Days Spent Grinding', min_value=1, max_value=365)
better = 1 + float(x) * 0.01 if x > 0 else 0.9
num = better**y
st.write(' Marginal Gains by getting {}% better for {} days will be : '.format(x, y))
if len(str(num)) < 25:
st.write(f'{num:,f}')
else:
st.write(num)
# with compounding
i = np.linspace(1, 365)
j = better**i
k = (0.05)*i+1 # Random Gradual growth Equation
plt.plot(i, k, label='What we Think!')
plt.plot(i, j, label='What Actually Happens!')
plt.xlabel("Results")
plt.ylabel("% Growth")
plt.legend()
st.pyplot(plt)
# st.pyplot(plt)