Data Visualization

##Visualizing by my own
import csv
def setup():
size(500, 500)
with open("/Users/Mai/Dropbox/Fall_2017/Data_Mining/Data/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 = 10
x = 0

for magnitude in magnitudes:
left_edge = x - (magnitude*scalar) / 2
right_edge = x + (magnitude*scalar) / 2

if magnitude*scalar < 10:
ellipse(width/2, x, magnitude*scalar, magnitude*scalar)
fill(211, 211, 211)
else:
ellipse(width/2, x, magnitude*scalar*2, magnitude*scalar*2)
fill(47, 79, 79)

if left_edge < mouseY and mouseY < right_edge:
ellipse(width/2, x, magnitude*scalar*3, magnitude*scalar*3)
fill(255, 0, 0)
x +=14