diff --git a/good_sprite.py b/good_sprite.py index fad0ccb..a942304 100644 --- a/good_sprite.py +++ b/good_sprite.py @@ -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] diff --git a/math.py b/math.py new file mode 100644 index 0000000..215a87e --- /dev/null +++ b/math.py @@ -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() + + +