Use symlog
scale instead of log
This commit is contained in:
parent
ef3e8ef337
commit
f090374caf
@ -39,6 +39,8 @@ PRINT_TRANSACTIONS = False
|
||||
|
||||
totalMonthlyDebits = []
|
||||
totalMonthlyCredits = []
|
||||
totalMonthlyDifferences = []
|
||||
totals = []
|
||||
firstDatetime = None
|
||||
lastDatetime = None
|
||||
for folder in sorted(os.listdir()):
|
||||
@ -66,6 +68,7 @@ for folder in sorted(os.listdir()):
|
||||
currentAmount = initialAmount
|
||||
print('Initial amount', initialAmount)
|
||||
print()
|
||||
totals += [initialAmount]
|
||||
started = True
|
||||
continue
|
||||
else:
|
||||
@ -82,6 +85,9 @@ for folder in sorted(os.listdir()):
|
||||
print(f'Total monthly credit: {totalMonthlyCredit}')
|
||||
totalMonthlyDebits += [totalMonthlyDebit]
|
||||
totalMonthlyCredits += [totalMonthlyCredit]
|
||||
totalMonthlyDifference = totalMonthlyCredit - totalMonthlyDebit
|
||||
#print(totalMonthlyDifference)
|
||||
totalMonthlyDifferences += [totalMonthlyDifference]
|
||||
break
|
||||
if firstLineOfPaymentRegex.match(line) is not None:
|
||||
if date is not None and PRINT_TRANSACTIONS:
|
||||
@ -108,21 +114,23 @@ def getMonthIndex(aDatetimeStr):
|
||||
aDatetime = datetime.strptime(aDatetimeStr, '%Y%m%d.pdf')
|
||||
return aDatetime.year * 12 + aDatetime.month
|
||||
|
||||
'''
|
||||
print(firstDatetime)
|
||||
print(lastDatetime)
|
||||
exit(1)
|
||||
'''
|
||||
#print(getMonthIndex(firstDatetime))
|
||||
#print(getMonthIndex(lastDatetime))
|
||||
xTicks = range(getMonthIndex(firstDatetime), getMonthIndex(lastDatetime) + 1)
|
||||
#print(len(xTicks))
|
||||
#print(len(totalMonthlyDebits))
|
||||
plt.bar(xTicks, totalMonthlyDebits, alpha = ALPHA, label = 'Debit')
|
||||
plt.bar(xTicks, totalMonthlyCredits, alpha = ALPHA, label = 'Credit')
|
||||
# sign does not seem respected for `totalMonthlyDifferences`.
|
||||
#print(totalMonthlyDifferences)
|
||||
#print(f'{min(totalMonthlyDifferences)}')
|
||||
#print(f'{max(totalMonthlyDifferences)}')
|
||||
totalMonthlyAmountAndLabel = (
|
||||
#(totalMonthlyDebits, 'Debit'),
|
||||
#(totalMonthlyCredits, 'Credit'),
|
||||
(totalMonthlyDifferences, 'Difference'),
|
||||
(totals, 'Total'),
|
||||
)
|
||||
for totalMonthlyAmount, totalMonthlyLabel in totalMonthlyAmountAndLabel:
|
||||
plt.bar(xTicks, totalMonthlyAmount, alpha = ALPHA, label = totalMonthlyLabel)
|
||||
plt.legend()
|
||||
|
||||
plt.yscale('log')
|
||||
# Hides negative
|
||||
#plt.yscale('symlog')
|
||||
ax.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,}'))
|
||||
|
||||
def getMonthName(monthIndex):
|
||||
|
Loading…
Reference in New Issue
Block a user