swap sideways
This commit is contained in:
parent
0fa60109b9
commit
8454fe6aec
@ -75,19 +75,21 @@ def get_goodreads_stats():
|
|||||||
def get_stats(pages, books):
|
def get_stats(pages, books):
|
||||||
size = 3
|
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)
|
coords = defaultdict(list)
|
||||||
|
|
||||||
for column in range(0, size):
|
columns = ["year", "books", "pages"]
|
||||||
for row in range(0, len(rows)):
|
|
||||||
coords[rows[row]].append([
|
start_x, start_y = 12, 25
|
||||||
row_offsets[row] + x_start + (column*col_w),
|
column_offset = [0,70,140]
|
||||||
y_start + (row*col_h),
|
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 = []
|
_stats = []
|
||||||
for idx, year in enumerate(list(reversed(sorted(books.keys())))[:size]):
|
for idx, year in enumerate(list(reversed(sorted(books.keys())))[:size]):
|
||||||
page_count = pages[year]
|
page_count = pages[year]
|
||||||
|
30
math.py
Normal file
30
math.py
Normal 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()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user