Earthquake Magnitude

'''
import csv
def setup():
size(600, 600)
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(255)
scalar=10
x = 0
for magnitude in magnitudes:
leftEdge = x - (magnitude * scalar)/2
rightEdge = x + (magnitude * scalar)/2
if leftEdge < mouseX and mouseX < rightEdge:
fill(249, 72, 37)
else:
fill(249, 214, 241)
rect(x, height/2, magnitude*scalar, magnitude*scalar)
x +=2.5
Like what you read? Give Whigham Rachel Covington a round of applause.

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