Earthquake magnitude

import csv
def setup():
size(800, 1000)
with open("quakes.csv") as f:
reader = csv.reader(f)
header = reader.next() # Skip the header row.
global magnitudes
magnitudes = []
for row in reader:
magnitude = float(row[4])
magnitudes.append(magnitude)
def draw():
background(0)
scalar=100
y = 0
for magnitude in magnitudes:
aboveEdge = y
belowEdge = y+20
if aboveEdge < mouseY and mouseY < belowEdge:
if magnitude*scalar>70:
fill(242, 47, 21)
rect(50, y, magnitude*scalar*2,20)
else:
fill(21, 131, 241)
rect(50, y, magnitude*scalar,20)
else:
fill(219, 219, 221)
rect(50, y, magnitude*scalar,20)
y +=20

If the magnitute is greater than 7, it is destructive. Highlight it with red color and double the length of bars.

Like what you read? Give Hui Liu a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.