Compare commits
2 commits
2a55ced6ea
...
cb4f025781
| Author | SHA1 | Date | |
|---|---|---|---|
| cb4f025781 | |||
| 1f9bcd6ae1 |
4 changed files with 18 additions and 9 deletions
|
|
@ -4,6 +4,5 @@ This tool automaticly composites graphs onto your slides for you. Just edit the
|
||||||
## Usage (Python must be installed)
|
## Usage (Python must be installed)
|
||||||
1. Download tool and extract the files
|
1. Download tool and extract the files
|
||||||
2. Enter folder
|
2. Enter folder
|
||||||
3. Intall dependencies with ``` pip install openpyxl PIL ```
|
3. Click run.bat
|
||||||
4. Run ```python main.py```
|
4. check the **gen** folder for the generated slides
|
||||||
5. Check the **gen** folder for the outputed images
|
|
||||||
17
graphs.py
17
graphs.py
|
|
@ -1,9 +1,14 @@
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
import imageGen
|
||||||
|
|
||||||
def currency_fmt(num):
|
def currency_fmt(num):
|
||||||
return ("$"+("{:0,.2f}".format(float(num))))[:-3] # Cents are dropped from diplay
|
if num < 1000:
|
||||||
|
return ("$"+("{:0,.2f}".format(float(num))))[:-3]
|
||||||
|
if num > 1000000:
|
||||||
|
return "$"+imageGen.format_frendly_M(num)
|
||||||
|
return "$"+imageGen.format_frendly(num)
|
||||||
|
|
||||||
def make_basic_greenred(name, v1, v2):
|
def make_basic_greenred(name, v1, v2, font=24):
|
||||||
title = (name)
|
title = (name)
|
||||||
width = 0.2
|
width = 0.2
|
||||||
bottom = 0
|
bottom = 0
|
||||||
|
|
@ -15,12 +20,12 @@ def make_basic_greenred(name, v1, v2):
|
||||||
|
|
||||||
#make fist bar and offset the bottom line by it
|
#make fist bar and offset the bottom line by it
|
||||||
p = ax.bar(title, [v1], width, bottom=bottom, align='center',color='tab:green')
|
p = ax.bar(title, [v1], width, bottom=bottom, align='center',color='tab:green')
|
||||||
ax.bar_label(p, label_type='center', fmt=currency_fmt)
|
ax.bar_label(p, label_type='center', fmt=currency_fmt, font={'size':font})
|
||||||
bottom += v1
|
bottom += v1
|
||||||
|
|
||||||
#make second bar graph
|
#make second bar graph
|
||||||
p = ax.bar(title, [v2], width, bottom=bottom, align='center', color='tab:red')
|
p = ax.bar(title, [v2], width, bottom=bottom, align='center', color='tab:red')
|
||||||
ax.bar_label(p, label_type='center', fmt=currency_fmt)
|
ax.bar_label(p, label_type='center', fmt=currency_fmt, font={'size':font})
|
||||||
|
|
||||||
return fig
|
return fig
|
||||||
|
|
||||||
|
|
@ -83,13 +88,13 @@ def gen_Roth_Catch_Up(wb):
|
||||||
|
|
||||||
# Generates graph for 401K contribution
|
# Generates graph for 401K contribution
|
||||||
def gen_401K_Contribution(wb):
|
def gen_401K_Contribution(wb):
|
||||||
fig = make_basic_greenred("401K Contribution",wb["O Mountain"]["A6"].value,wb["O Mountain"]["C6"].value)
|
fig = make_basic_greenred("401K Contribution",wb["O Mountain"]["A6"].value,wb["O Mountain"]["C6"].value,15)
|
||||||
|
|
||||||
fig.savefig('./.gen/401K_Contribution.png',dpi=300)
|
fig.savefig('./.gen/401K_Contribution.png',dpi=300)
|
||||||
|
|
||||||
# Generates graph for 401K contribution Catch Up
|
# Generates graph for 401K contribution Catch Up
|
||||||
def gen_401K_Catch_Up(wb):
|
def gen_401K_Catch_Up(wb):
|
||||||
fig = make_basic_greenred("401K Catch Up",wb["O Mountain"]["A8"].value,wb["O Mountain"]["C8"].value)
|
fig = make_basic_greenred("401K Catch Up",wb["O Mountain"]["A8"].value,wb["O Mountain"]["C8"].value,15)
|
||||||
|
|
||||||
fig.savefig('./.gen/401K_Catch_Up.png',dpi=300)
|
fig.savefig('./.gen/401K_Catch_Up.png',dpi=300)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,3 +130,8 @@ def gen_Oh_I_Mountain(wb):
|
||||||
def format_frendly(num):
|
def format_frendly(num):
|
||||||
T = num / 1000
|
T = num / 1000
|
||||||
return str(int(np.floor(T)))+"K"
|
return str(int(np.floor(T)))+"K"
|
||||||
|
|
||||||
|
def format_frendly_M(num):
|
||||||
|
T = num / 1000000
|
||||||
|
return str(int(round(T,1)))+"M"
|
||||||
|
#return str(round(T,1))+"M"
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 243 KiB |
Loading…
Add table
Add a link
Reference in a new issue