hadoop meetup 2014

56
D3, VISUALIZATIONS, N’AT Patrick M. Dudas @pdudders

Upload: dudaspm

Post on 06-May-2015

163 views

Category:

Technology


5 download

DESCRIPTION

Hadoop Users Group Pittsburgh discusses D3.js

TRANSCRIPT

Page 1: Hadoop meetup 2014

D3, VISUALIZATIONS, N’ATPatrick M. Dudas

@pdudders

Page 2: Hadoop meetup 2014

Who I am..

Page 3: Hadoop meetup 2014

Data Visualization (Meetup)

Art

Data

Coding

UI/UX

Github: https://github.com/dudaspm/Pittsburgh-Data-Visualization

Page 4: Hadoop meetup 2014

Data Mining Process

Page 5: Hadoop meetup 2014

Edward Tufte

“With most visualizations and graphics, the main focus is to take multiple dimensions of information and project it on to a two-dimension plot”

Page 6: Hadoop meetup 2014

Infographic

Infographic, Model, or Visualization

Model

http://fold.it/portal/info/about - University of Washington

Visualization

Page 7: Hadoop meetup 2014

7

When Graphics Go Bad

Challenger January 28, 1986

Page 8: Hadoop meetup 2014

8

Can Anyone Spot the Problem?

Page 9: Hadoop meetup 2014

9

How About Now?

Page 10: Hadoop meetup 2014

#1 Asked Question

I have “this data.” What visualization should I use?

http://www.datavis.ca/gallery/evil-pies.php

Data123443103523229

Data0.06383

0.180851 0.228723 0.053191 0.18617 0.12234

0.117021 0.047872

Normalize

Visualization?

Page 11: Hadoop meetup 2014

Steamgraph, Sparklines, and Treemaps

Page 12: Hadoop meetup 2014

Hive Plots, Star Plots, and Parallel Coordinates

Page 13: Hadoop meetup 2014

Back to the #1 Asked Question I have “this data.”

What visualization should I use? Ask your users or experts

Page 14: Hadoop meetup 2014

How to Get to D3

HTMLJavascript/JQuery

XML SVG D3

Page 15: Hadoop meetup 2014

HTML

<html>

<head>

<title>I am metadata</title>

<script src="http://d3js.org/d3.v3.min.js"></script>

</head>

<body>

the body of HTML

</body>

</html>

http://boxnumbertwo.com/D3Simple/1.0/example1.html

Page 16: Hadoop meetup 2014

DIV

<html><head>

<title>I am metadata</title><script src="../d3/d3.min.js"></script>

</head><body>

<div id="visualization_here"></div></body>

</html>

Page 17: Hadoop meetup 2014

Not Well Formatted HTML

<html><head>

<title>I am a webpage</title><script src="../d3/d3.min.js"></script>

</header><ody>

<div id="visualization_here"></div></body

</html>

Page 18: Hadoop meetup 2014

XML (Must Be Well Formatted)<?xml version="1.0"?><note> <to>Dave</to> <from>Jamie</from> <heading>Reminder</heading> <message>Don't forget me this

weekend!</message></note>

Page 19: Hadoop meetup 2014

SVG<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="400px"

height="400px">

<polygon points="200,10 250,190 160,210" style="fill:lime;stroke-width:1"/>

</svg>

Page 20: Hadoop meetup 2014

SVG vs. Canvas or Vector vs. Raster

Canvas = Pixels Raster

SVG Points Lines Polygons

Vector

Page 21: Hadoop meetup 2014

D3 - http://d3js.org/

Data Driven Documents Enter, Update, Exit Interactions Transitions

Big List of Examples (1900) http://christopheviau.com/d3list/index.html

Page 22: Hadoop meetup 2014

D3.js

SVG, CSS, and HTML update

update your data enter

enter svg objects using that data (example6)OR

exit remove svg using that data (example7)

mouse events (example8) transitions (example9)

smoothly change data example10 – adding affordances and a little fun

Page 23: Hadoop meetup 2014

Simple Exam of D3

var circleData = [4, 8, 15, 16, 23, 42];

http://boxnumbertwo.com/D3Simple/1.0/example6.html

Page 24: Hadoop meetup 2014

Bertin’s Retinal/Visual Variable

Page 25: Hadoop meetup 2014

Adding Some Aesthetics

var color = d3.scale.category10();newCircles.enter().append("circle")

.attr("cx", function(d) { return d*10; })

.attr("cy", function(d) { return d*10; })

.attr("r", function(d) { return d; })

.style("fill", function(d) { return color(d); });

http://boxnumbertwo.com/D3Simple/1.0/example7.html https://github.com/mbostock/d3/wiki/Ordinal-Scales#wiki-category10http://boxnumbertwo.com/D3Simple/NetworkX/1.6/index.php?sizeOfGraph=60&ProbabilityOfEdge=.03

Page 26: Hadoop meetup 2014

Enter, Update, Exit

http://boxnumbertwo.com/D3Simple/1.0/example7.html

Page 27: Hadoop meetup 2014

Change Blindness

Minimizing changes in a scene to make visual changes more noticeable.

Page 28: Hadoop meetup 2014

Sometimes We Miss the Change Change Blindness - phenomenon that

occurs when a person viewing a visual scene apparently fails to detect large changes in the scene (Wikipedia)

http://www.csc.ncsu.edu/faculty/healey/PP/movies/Dinner.gif

http://www.csc.ncsu.edu/faculty/healey/PP/movies/Airplane.gif

http://www.csc.ncsu.edu/faculty/healey/PP/movies/Chopper_Truck.gif

Page 29: Hadoop meetup 2014
Page 30: Hadoop meetup 2014
Page 31: Hadoop meetup 2014

Smooooooth Transitions

newerCircles.exit().transition().duration(3000).attr("r", 0).remove();

http://boxnumbertwo.com/D3Simple/1.0/example9.hthttp://www.boxnumbertwo.com/PitterPatter/1.2/ml

Page 32: Hadoop meetup 2014

32

Don Norman’s Design of Everyday Things

Builds on the notion of affordances Affordance – "refers to the perceived and

actual properties of the thing, primarily those fundamental properties that determine just how the thing could possibly be used … Affordances provide strong clues to the operations of things" (Norman, 1988) This can include objects or words/numbers!

Norman, D. A. (1988).  The design of everyday things. New York, Doubleday

Page 33: Hadoop meetup 2014

Affordance

Page 34: Hadoop meetup 2014

34

Affordance Scenario 1

http://www.baddesigns.com

Page 35: Hadoop meetup 2014

35

Trapped between the doors! She was walking from one building to the other

with a co-worker. They pulled the handles that opened the doors and went down the walkway. Upon reaching the other end they again pulled the handles, but the doors wouldn't budge. Assuming the doors were locked, they returned to the doors they originally opened to enter the walkway. But when they tried to pull open these doors, they wouldn't open either. They were trapped in the walkway between the two buildings!

My friend and her co-worker spent the next few minutes trying to signal to people though the windows in the buildings, but the people they signaled seemed strangely reluctant to come to the rescue. Finally, after trying the doors again, they discovered they needed to push the doors rather than pull them.

Page 36: Hadoop meetup 2014

Let’s Add Some Affordances

newCircles.enter().append("circle").attr("cx", function(d) { return d*10; }).attr("cy", function(d) { return d*10; }).attr("r", function(d) { return d; }).style("fill", function(d) { return color(d); }).style("stroke-width", 0).style("stroke", "black").style("cursor", "pointer")// on mouse-over, change the border of the given circle to 2.on("mouseover", function() {d3.select(this).style("stroke-width", 2)})// on mouse-out, change the border back to the original (0).on("mouseout", function() {d3.select(this).style("stroke-width", 0)})

http://boxnumbertwo.com/D3Simple/1.0/example10.html

Page 37: Hadoop meetup 2014

Heatmap

Page 38: Hadoop meetup 2014

38

Heat Map

Page 39: Hadoop meetup 2014

39

Heat Map

Page 40: Hadoop meetup 2014

Matrix + Layers + Color = Heatmap

redM.push(0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0)redM.push(0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0)redM.push(0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,0)redM.push(0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0)redM.push(0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0)redM.push(0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)redM.push(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);http://boxnumbertwo.com/D3Simple/mario/standing.htm

l

Page 41: Hadoop meetup 2014

Chaining Transitions

var t0 = vis.transition().ease('quad-in').selectAll("rect");t0.style("fill", function(d,i) { return marioColors[d[1][1]]; });var t1 = t0.transition();t1.style("fill", function(d,i) { return marioColors[d[2][1]]; });

http://boxnumbertwo.com/D3Simple/mario/marioMoving.html

Page 42: Hadoop meetup 2014

Javascript Timers + D3 = Animationvar cloud_scale_1 = .8, cloud_translate_1 = [700,100];setInterval(function(){moveCloud_1();},25);

var boo_2 = 0;var cloud_scale_2 = .6, cloud_translate_2 = [0,300];setInterval(function(){moveCloud_2();},30);

var boo_3 = 0;var cloud_scale_3 = .7, cloud_translate_3 = [300,0];setInterval(function(){moveCloud_3();},40);

var boo_4 = 0;var cloud_scale_4 = .9, cloud_translate_4 = [500,200];setInterval(function(){moveCloud_4();},55);

http://boxnumbertwo.com/D3Simple/6.1/

Page 43: Hadoop meetup 2014

43 Dynamic Twitter Network Analysis

Page 44: Hadoop meetup 2014

44

Overall Platform

Page 45: Hadoop meetup 2014

45

Ubiquitous Platform

Built upon HTML5 standards Does not require any additional software

to be downloaded All major browsers:

IE, Firefox, Chrome, Safari, Opera, etc. Supports all UTF-8 and Unicode

character types

Page 46: Hadoop meetup 2014

46

Networks

James tweets: “Just saw @Dannie at the #Pittsburgh #Library. Checked out this book: http://bit.ly/U8AGsc” Username -> Username:

James -> Dannie Username -> Hashtag:

James -> Pittsburgh and James -> Library Hashtag -> Hashtag:

Pittsburgh -> Library Username -> URL:

James -> http://bit.ly/U8AGsc

Page 47: Hadoop meetup 2014

47

DTNA Layout

Page 48: Hadoop meetup 2014

48

Saliency and Network

limited to 100 nodes clustering algorithm

differentiated by color coding bias to inner-cluster

strength to inter-cluster strength

edge directionality bias inner-cluster vs.inter-cluster

log-based degree centrality highlight 1st degree

connections

Blondel, V. D., Guillaume, J. L., Lambiotte, R., & Lefebvre, E. (2008). Fast unfolding of communities in large networks. Journal of Statistical Mechanics: Theory and Experiment, 2008(10), P10008.

Page 49: Hadoop meetup 2014

49

Real-Time Network

Page 50: Hadoop meetup 2014

50

Dynamic Query and Layout

Page 51: Hadoop meetup 2014

51

Export Network

Export: UCINET Gephi Palantir Pajek

Page 52: Hadoop meetup 2014

52

TweetViewer

Page 53: Hadoop meetup 2014

53

TweetViewer Timeline

Page 54: Hadoop meetup 2014

54

Sentiment Analysis

F. Å. Nielsen, "A new ANEW: Evaluation of a word list for sentiment analysis in microblogs," Arxiv preprint arXiv:1103.2903, 2011.

Page 55: Hadoop meetup 2014

55

Sentiment Analysis

Negative Words:• Sad• Murder• Disgust• WTF• Kill•

Positive Words:• Praise• Love• Dear• kind• Hope•

http://www.youtube.com/watch?v=ao6V_5sK3-A

Page 56: Hadoop meetup 2014

Thank you!

Contact: [email protected] Github:

https://github.com/dudaspm/Pittsburgh-Data-Visualization