Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 100 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
ce3d838
Setting up GitHub Classroom Feedback
github-classroom[bot] Apr 25, 2021
d0e3698
added data
elizabeth114 Apr 25, 2021
2e863a4
added parser removed extra column
elizabeth114 Apr 25, 2021
e7fce23
small change
elizabeth114 Apr 25, 2021
961d2c4
named data
elizabeth114 Apr 25, 2021
39cd4ee
added persons
elizabeth114 Apr 26, 2021
9de2dbf
added buttons
elizabeth114 Apr 26, 2021
8f8db20
changed moving speed
elizabeth114 Apr 26, 2021
bfbc3bd
delayed transition
elizabeth114 Apr 26, 2021
d9a87d6
added tooltip need to clean
elizabeth114 Apr 26, 2021
dc90d9e
Only move icons that need to
Apr 26, 2021
8e11e9c
stopped tooltip flicker
elizabeth114 Apr 26, 2021
5776f0e
Merge branch 'benton-less-move' into main
Apr 26, 2021
a55e9b6
Things working need to clean up:
Apr 27, 2021
6c994cf
Works but gross
Apr 27, 2021
ec54337
Removing dead code
Apr 27, 2021
127e003
Changed to use opacity instead of black fill
Apr 27, 2021
54ca3f8
Things should be cleaner now
Apr 27, 2021
4f4683a
started working on scroller
elizabeth114 Apr 30, 2021
80a1210
more scroll progress
elizabeth114 Apr 30, 2021
01112d2
stopping for now
elizabeth114 Apr 30, 2021
faff3cb
can scroll and stuff changes
elizabeth114 May 1, 2021
200c35d
Nicer tooltip, square dudes
May 1, 2021
bec33fc
Merge branch 'adding-labels' into main
May 1, 2021
da06173
Works but something weird with divs
May 1, 2021
d4b1f37
compiled data for 2048
elizabeth114 May 1, 2021
75286de
remvoed comments
elizabeth114 May 1, 2021
2bd93e5
Sizing fixed
May 1, 2021
81b5d35
Merge branch 'benton-sizing' into main
May 1, 2021
e4eec6f
Formatting of code
May 1, 2021
7499160
still moves when scrolling within section
elizabeth114 May 2, 2021
e7c78b7
moved buttons to bottom and made panels appear on the left.
elizabeth114 May 2, 2021
3d1cfd3
added to data
elizabeth114 May 2, 2021
ceaf086
fixed data
elizabeth114 May 2, 2021
a82fafb
moved column helpers into a folder seems cleaner
elizabeth114 May 2, 2021
2ff2eb6
added us prison
elizabeth114 May 2, 2021
61a308b
moved script to file
elizabeth114 May 2, 2021
d4d04c0
moved panel to css
elizabeth114 May 2, 2021
c1edad6
added 2 more panels
elizabeth114 May 2, 2021
f96fe78
added not in prison for first one
elizabeth114 May 2, 2021
7b9d97b
fixed prison tooltip and initial coloring
elizabeth114 May 2, 2021
d11e789
added louisianna prison stats
elizabeth114 May 2, 2021
8b0f50e
combined drugs
elizabeth114 May 2, 2021
d78f379
added more to panels
elizabeth114 May 2, 2021
2f269e1
scrolling up now changes color and moves dudeds
elizabeth114 May 2, 2021
b071636
added stuff for marijuana
elizabeth114 May 2, 2021
3e8375b
messed with the colors some more
elizabeth114 May 2, 2021
814b9da
inv weed
elizabeth114 May 2, 2021
8ec0be0
Changed so we can easily add colors and don't have to store as much data
May 3, 2021
7a2f9c5
Most of things for MVP milestone
May 3, 2021
a9be5a8
Added queue idea in notes.md
May 3, 2021
e717c93
Added known TODOs for final project so far
May 3, 2021
052ae3d
Made labels line up slightly better
May 3, 2021
0e99c37
Implemented transitions not freezing each other
May 4, 2021
7446d40
Implemented the labels staying
May 4, 2021
71b7bb4
People are transparent at start; fixes tooltip displaying on scroll up
May 4, 2021
f7eb04f
Revert "People are transparent at start; fixes tooltip displaying on …
May 4, 2021
566a9c6
Made chart hide so tooltips don't show up at top
May 9, 2021
7369f67
Small fix with tooltip still showing with all white icons
May 9, 2021
8057f60
small changes started compiling data
elizabeth114 May 9, 2021
562f5a2
Merge branch 'main' of github.com:6859-sp21/final-project-marijuana
elizabeth114 May 9, 2021
473e61c
Reload goes to top + percentages in tooltip
May 9, 2021
1ea32ab
Merge branch 'benton-percentages-tooltip' into main
May 9, 2021
21ba454
added states
elizabeth114 May 9, 2021
c012533
merge
elizabeth114 May 9, 2021
a32fdf2
fixed selector
elizabeth114 May 9, 2021
1c72020
Smaller people in grid
May 9, 2021
2cbf538
Tooltip color matches the people color
May 9, 2021
0dc17ea
colors for states etc
elizabeth114 May 9, 2021
02efa67
Merge branch 'main' of github.com:6859-sp21/final-project-marijuana
elizabeth114 May 9, 2021
88bcfd8
Labels no longer lag to change color
May 9, 2021
91b183d
changed colors
elizabeth114 May 9, 2021
8be37ed
Merge branch 'main' of github.com:6859-sp21/final-project-marijuana
elizabeth114 May 9, 2021
fab56ab
more color stuff
elizabeth114 May 9, 2021
28fa43d
attempted to fix colors
elizabeth114 May 10, 2021
b9f5763
graph works but want better tooltip
elizabeth114 May 10, 2021
f65a0b3
Added links to prison reform website
May 10, 2021
29a68b4
Merge branch 'main' of https://github.com/6859-sp21/final-project-mar…
May 10, 2021
0d5c2dd
Merge branch 'main' of github.com:6859-sp21/final-project-marijuana
elizabeth114 May 10, 2021
a4a9b4f
fixes to graphs and added another link
elizabeth114 May 10, 2021
3010233
added data files
elizabeth114 May 10, 2021
2bc6280
chart works on the left but is bad
May 10, 2021
989a6f2
fixed wording
elizabeth114 May 10, 2021
d1d4c4d
Merge branch 'main' of github.com:6859-sp21/final-project-marijuana
elizabeth114 May 10, 2021
9104d5b
Fixed line staying on mouseout of chart
May 10, 2021
35e702e
chart working; needs to move to correct panel
May 10, 2021
fdbf2bf
New chart should be working
May 10, 2021
b68ae08
Fixed some minor things/typos
May 10, 2021
4d01074
Added race column helper and removed bad console log
May 10, 2021
3d92b90
fixed jittering chart in Safari
May 11, 2021
e40e8a8
changed buttons, colors for race, colors for state selector, color fo…
elizabeth114 May 11, 2021
2cfcb02
small change to link
elizabeth114 May 11, 2021
d95ef88
fixed label styled (overlapping label classes)
May 11, 2021
77630e7
Added FinalPaper.pdf
May 15, 2021
daaca18
test readme
elizabeth114 May 15, 2021
0cbe16a
test readme
elizabeth114 May 15, 2021
88043bb
Merge branch 'main' of github.com:6859-sp21/final-project-marijuana
elizabeth114 May 15, 2021
aaef29f
added picture
elizabeth114 May 15, 2021
f35d7c1
asdlkfa;hjf
elizabeth114 May 15, 2021
9765e8a
Updated Readme with final notes
elizabeth114 May 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# final-project-starter-code
## We are including the team page in the readme, as allowed on Slack.

* Title: Prison in The U.S.
Formerly: Marijuana Legalization
* Team Members: Elizabeth Weeks (eweeks), Benton Wilson (benton)
* Summary Image:
<img src="./people.png"
alt="Prison Graph"
style="float: left; margin-right: 10px;" />

* Abstract
* Mass incarceration is a large, but often hidden issue in the United States. The number of prisoners in the U.S. has increased drastically in the last few decades, and it is an important issue to understand so that we can start to solve the problem as we try to overcome systemic racism. Using the D3 library as well as techniques learned during 6.859: Iteractive Data Visualization, we constructed a scrollytelly website in order to visualize the makeup of the U.S. prison popula- tion, relying mostly on a dynamically updating matrix of humanoid icons. At the end of the narrative walk through, users are invited to both explore the data further as well as visit websites of various organizations trying to take action against mass incarceration.

* Link to Paper:
* Is in FinalPaper.pdf in this readme, and also availiable at: [https://6859-sp21.github.io/final-project-marijuana/final/FinalPaper.pdf](https://6859-sp21.github.io/final-project-marijuana/final/FinalPaper.pdf)
* Link to video:
* [https://www.youtube.com/watch?v=cyY8JSKUUFo](https://www.youtube.com/watch?v=cyY8JSKUUFo)
* Running instructions
* Our project result is a website. To get there go to [https://6859-sp21.github.io/final-project-marijuana/src/index.html](https://6859-sp21.github.io/final-project-marijuana/src/index.html)

* Breakdown of work
* Overall we think that the work was split very evenly. Most of our work was done through pair programming or spliting up the work while coding in the same room.
* We did most of our work during large chunks of time where we would create a list of tasks and then try to get through as many as possible before being done for the day.
* Commentary on project progress
* The overall flow of our project development was: first get, process and explore the data, then work on making the icon visual render, then work on building a website aruond the visual, and finally iterate to improve.
* Compared to A4, we placed much more emphasis on keeping our codebase modular and clean. Much of our code structure is based around callbacks, which are passed to handlers that use the callback to change the rendering of the grid of icons. This meant that in order to add a new filter, we just had to write a few small callback functions, which made the development process much faster.
* Even though we still ran into issues with D3, we both feel significantly more comfortable with the data join as well as D3 selections.
Binary file added data/.DS_Store
Binary file not shown.
102 changes: 102 additions & 0 deletions data/compile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import csv
import os
import pandas as pd
import random
import math

num_people = 2048
us_prison_per = 0.007
louisianna_per = 0.024
extra_r = [us_prison_per]
extra_names = ["percent us in prison"]
state_name = "percent {} in prison"

def add_states(df_big):
df = pd.read_csv("./states.csv")
for row in df.iterrows():
print(row)
print(row[0])
print(row[1]["State"])
state = row[1]["State"]
percent = row[1]["incarcerated rate"]
new_column = []
print(percent)
values = [1, 0]
percentages = [percent, 1-percent]
for index in range(len(percentages)):
people = round(2048*percentages[index])
new_column += [values[index] for i in range(people)]
random.shuffle(new_column)
df_big[state_name.format(state)] = new_column
return df_big


#-55 is my special value for other
def convert_to_column(df, df2, name, column_dict, total):
new_column = []
values = []
percentages = []
for value in column_dict:
values.append(value)
people = math.floor(num_people*column_dict[value]/total)
percentage = people/num_people
percentages.append(percentage)
new_column += [value for i in range(0, people)]
extra = num_people - len(new_column)
new_column += [-55 for i in range(0, extra)]
values.append(-55)
percentages.append(extra//total)
values = pd.Series(values)
percentages = pd.Series(percentages)
df2[name + ": values"] = values
df2[name + ":percentages"] = percentages
random.shuffle(new_column)
df[name] = new_column
return df, df2

def extra_rows(df, df2):
values = [0, 1]
for outer in range(len(extra_r)):
percent = extra_r[outer]
new_column = []
percentages = []
percentages = [1-percent, percent]
for index in range(len(percentages)):
people = round(2048*percentages[index])
new_column += [values[index] for i in range(people)]
random.shuffle(new_column)
df[extra_names[outer]] = new_column
values = pd.Series(values)
percentages = pd.Series(percentages)
df2[extra_names[outer] + ": values"] = values
df2[extra_names[outer] + ":percentages"] = percentages
return df, df2



read_file = pd.read_csv("./filtereddata.csv")
index = 0
count = 0
df = pd.DataFrame([i for i in range(1, num_people + 1)], columns=["V0001B: Respondent ID"])
df2 = pd.DataFrame()
for name in read_file.columns:
if index == 0:
index += 1
continue

column_dict = {}
for value in read_file[name]:
if index == 1:
count+= 1
if value in column_dict:
column_dict[value] += 1
else:
column_dict[value] = 1
index += 1
df, df2 = convert_to_column(df, df2, name, column_dict, count)
df, df2 = extra_rows(df, df2)
df = add_states(df)


df.to_csv("./compileddata.csv", mode = "w", index=False)
df2.to_csv("./percentagedata.csv", mode = "w", index=False)
Loading