Earthquake Colors

dare
Data Mining the City
2 min readSep 28, 2017

Arranged in order of latitude the interactive visualization above asks visitors to interact with the earthquake magnitude data. With very few visual markers as you scroll past each earthquake the saturation of the sketch changes in proportion to the magnitude of the earth quake.

import csvdef setup():
size(1096,600)
colorMode(HSB,360,100,100)
with open("filename.csv") as f:
reader = csv.reader(f)
header = reader.next()
global magnitudes
magnitudes = []
for row in reader:
magnitude = float(row[2])
magnitudes.append(magnitude)

def draw():
background(297,0,100)
magScale = 10
x = 0
for magnitude in magnitudes:
lbound = x - 4
rbound = x + 4

if lbound < mouseX and mouseX < rbound:
background(297,magnitude*10,100)
rect(0,600,width,height)
textSize(30)
text(magnitude, 100,100)
fill(0)

stroke(0,0,100)
x +=4
def setup():
size(500,500)
colorMode(RGB)
background(255, 255, 255)
def draw():
background(255, 0, 255)
#defining the feature variables
eyeRadius = 5
eyeY = 80 + (mouseY)
eyeLeftX = 60 + mouseX
eyeRightX = 100 + mouseX
faceCenterX = 60 + mouseX
faceCenterY = 80 + (mouseY)
headRad = 100
mouthX1 = 60 + mouseX
mouthY = 100 + (mouseY)
mouthX2 = 90 + mouseX

#drawing the face
stroke(0, 0, 0)
fill(0, 0, 0)
ellipse(eyeLeftX,eyeY,eyeRadius,eyeRadius)
ellipse(eyeRightX,eyeY,eyeRadius,eyeRadius)
noFill()
ellipse(faceCenterX,faceCenterY,headRad,headRad)
line(mouthX1,mouthY,mouthX2,mouthY)

--

--