swap sideways

This commit is contained in:
Tyrel Souza 2018-08-28 22:45:14 -04:00
parent 0fa60109b9
commit 8454fe6aec
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
2 changed files with 43 additions and 11 deletions

View File

@ -75,19 +75,21 @@ def get_goodreads_stats():
def get_stats(pages, books):
size = 3
col_w, col_h = 50, 32
x_start, y_start = 60, 14
row_offsets = [0,5,0]
rows = ["year", "books", "pages"]
coords = defaultdict(list)
for column in range(0, size):
for row in range(0, len(rows)):
coords[rows[row]].append([
row_offsets[row] + x_start + (column*col_w),
y_start + (row*col_h),
])
columns = ["year", "books", "pages"]
start_x, start_y = 12, 25
column_offset = [0,70,140]
year_offset = 15
for idy, year in enumerate(pages.keys()):
for idx, column in enumerate(columns):
coords[year].append((
start_x + column_offset[idx],
start_y + (year_offset * idy)
))
_stats = []
for idx, year in enumerate(list(reversed(sorted(books.keys())))[:size]):
page_count = pages[year]

30
math.py Normal file
View File

@ -0,0 +1,30 @@
from collections import defaultdict
pages = {"2014": 7375, "2015": 23508, "2016": 17696, "2017": 19706, "2018": 9388}
books = {"2018": 33,"2017":64,"2016":47,"2015":75,"2014":19}
def main():
years = ['2018','2017','2016','2015','2014']
coords = defaultdict(list)
columns = ["year", "books", "pages"]
start_x, start_y = 12, 25
column_offset = [0,70,140]
year_offset = 15
for idy, year in enumerate(years):
for idx, column in enumerate(columns):
coords[year].append((
start_x + column_offset[idx],
start_y + (year_offset * idy)
))
print coords
if __name__=="__main__":
main()