Interactive Visualization

Similar documents
Visualizing Data: Scalable Interactivity

CIS 467/602-01: Data Visualization

Interactive Data Visualization for the Web Scott Murray

Raising the Bar (Chart)

Introduction to D3.js Interactive Data Visualization in the Web Browser

Lab 2: Visualization with d3.js

Research on HTML5 in Web Development

CSE Data Visualization. Visualization Tools. Jeffrey Heer University of Washington

Real World D3.JS. John Hammer. This book is for sale at This version was published on

Programming in HTML5 with JavaScript and CSS3

4/25/2016 C. M. Boyd, Practical Data Visualization with JavaScript Talk Handout

Unlocking the Java EE Platform with HTML 5

Getting more out of Matplotlib with GR

How To Create Superpath In Gta (Gta 3) And Gta 4.5 (Gts) (Gt3.5) (Geo 3.3) (Html) (Sv

First Bytes Programming Lab 2

Adobe Illustrator CS5 Part 1: Introduction to Illustrator

DATA SCIENCE CURRICULUM WEEK 1 ONLINE PRE-WORK INSTALLING PACKAGES COMMAND LINE CODE EDITOR PYTHON STATISTICS PROJECT O5 PROJECT O3 PROJECT O2

R Tools Evaluation. A review by Global BI / Local & Regional Capabilities. Telefónica CCDO May 2015

Using HTML5 Pack for ADOBE ILLUSTRATOR CS5

Developer Tutorial Version 1. 0 February 2015

WEB AND APPLICATION DEVELOPMENT ENGINEER

caqtdm Tutorial Jim Stevens APS Controls Group October 9, 2014

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

THE SAS OUTPUT DELIVERY SYSTEM: BOLDLY TAKE YOUR WEB PAGES WHERE THEY HAVE NEVER GONE BEFORE! CHEVELL PARKER, SAS INSTITUTE INC.

06 XML-based Technologies

HTML5 & CSS3. ( What about SharePoint? ) presented

WP Popup Magic User Guide

ART 170: Web Design 1

d3.js Data-Driven Documents Scott Murray, Jerome Cukier & Jeffrey Heer VisWeek 2012 Tutorial

JavaScript and jquery for Data Analysis and Visualization

Mobile Performance: for excellent User Experience

IE Class Web Design Curriculum

Upgrade to Microsoft Web Applications

Dashboard Skin Tutorial. For ETS2 HTML5 Mobile Dashboard v3.0.2

Team Members: Christopher Copper Philip Eittreim Jeremiah Jekich Andrew Reisdorph. Client: Brian Krzys

Differences between HTML and HTML 5

Create Cool Lumira Visualization Extensions with SAP Web IDE Dong Pan SAP PM and RIG Analytics Henry Kam Senior Product Manager, Developer Ecosystem

R Graphics Cookbook. Chang O'REILLY. Winston. Tokyo. Beijing Cambridge. Farnham Koln Sebastopol

Programming exercises (Assignments)

Lession: 2 Animation Tool: Synfig Card or Page based Icon and Event based Time based Pencil: Synfig Studio: Getting Started: Toolbox Canvas Panels

How to create buttons and navigation bars

Assignment 5: Visualization

WEB DEVELOPMENT COURSE (PHP/ MYSQL)

The following is an overview of lessons included in the tutorial.

Facebook Twitter YouTube Google Plus Website . o Zooming and Panning. Panel. 3D commands. o Working with Canvas

HTML5 & Digital Signage

HOW Interactive Design Conference 2013

Adobe Illustrator CS6. Illustrating Innovative Web Design

The Image that called me

Dreamweaver and Fireworks MX Integration Brian Hogan

JavaFX Session Agenda

Visualization of 2D Domains

WP Popup Magic User Guide

Fireworks 3 Animation and Rollovers

HTML5 the new. standard for Interactive Web

^/ CS> KRIS. JAMSA, PhD, MBA. y» A- JONES & BARTLETT LEARNING

TUTORIAL 4 Building a Navigation Bar with Fireworks

OpenText Information Hub (ihub) 3.1 and 3.1.1

Visualization of Real Time Data Driven Systems using D3 Visualization Technique

Interactive Applications for Modeling and Analysis with Shiny

rcharts Documentation

Client Overview. Engagement Situation. Key Requirements

Modern PHP Graphics with Cairo. Michael Maclean FrOSCon 2011

Ad Hoc Reporting. Usage and Customization

Fireworks CS4 Tutorial Part 1: Intro

How to start with 3DHOP

Basic tutorial for Dreamweaver CS5

Vector Web Mapping Past, Present and Future. Jing Wang MRF Geosystems Corporation

Session 85 IF, Predictive Analytics for Actuaries: Free Tools for Life and Health Care Analytics--R and Python: A New Paradigm!

Designing The User Experience AIGA Design Camp

Comparative Analysis Report:

Visualizing a Neo4j Graph Database with KeyLines

Web Designing with UI Designing

Quick and Easy Web Maps with Google Fusion Tables. SCO Technical Paper

separate the content technology display or delivery technology

Visualization of Semantic Windows with SciDB Integration

Web Development with R

Intro to Web Design. ACM UIUC

Distributed Systems Seminar Spatio-Temporal Visualization System - STVS

Zhenping Liu *, Yao Liang * Virginia Polytechnic Institute and State University. Xu Liang ** University of California, Berkeley

Agents and Web Services

Outline. 1.! Development Platforms for Multimedia Programming!

Free Google Tools for Creating Interactive Mapping Mashups

maximizing IT productivity

Embedding Customized Data Visualization and Analysis

GUI and Web Programming

Website Builder Documentation

Transcription:

7th China R Conf (Beijing), 2014-05-25 Interactive Visualization with R 王亮博 (亮亮) shared under CC 4.0 BY Esc to overview to navigate

Online slide on http://ccwang002.gitcafe.com/chinarconf-interactive-vis/ 2

3 About Me Master student at Bioinfo & Biostat Core Lab, NTU CGM R / Python. Learning to speak DNA Taiwan R (MLDM) co-organizer PyCon APAC 2014 staff and speaker of Statistics in Python with R Handy Parallel(Distributed) Computing in Python

About Taiwan R User Group 4 More known a weekly meetup MLDM Monday (Machine Learning and Data Mining Monday) Topics ranges from R lang: basic tutorial, Rcpp, quantmod, ggplot2, slidify, knitr, googlevis Statistics, ML/DM: survival analysis, neural network, SVM, regression, nonparam. stat Big Data: Hadoop, MPI PyData: Numpy, Scikit-learn, pandas

My honor to be the first in this section. This is an introductory talk. 5

6 Topics Why interactive? How interactive in R? SVG intro Architecture of R graphics system intro R packages grid intro gridsvg intro Summary and limitation

Why and how?

8 From publication to manipulation Demo from http://timelyportfolio.github.io/gridsvg_intro/

9 Why interactive? Re-train your model (change the parameters): Shiny Provide more details of your data: tooltip Data are collected in real time Provide different view point of your data We just want to be fancy With today's method, we can reveal more details, provide different view points, and can be fancier :)

10 How interactive? In the past, one might first think of using GUI framework (QT, Gtk): iplot Real pain for developers, inexperience in GUI application devel embedded other non-interactive information is hard Also a pain for users, no need for another GUI application users now mainly from internet

11 Hope SVG here someday Web and browsers dominates our frontend world. Almost every PC and mobile have a modern browser today.

12 How interactive in R? Put everything on web (in the cloud) Use SVG to plot Mainly two ways: Usual R plots parse R plot object output SVG add interactivity on SVG Use R lang to generate SVG directly We take the first way in this talk.

13 Why SVG? Scalable Vector Graphics (SVG) is an XML markup language for describing two-dimensional vector graphics. Mozilla Developer Network Web standard widely supported by both desktop and mobile browsers Manipulate SVG elements by javascript and CSS; Animation is possible (not in R) most graphic tools can export to SVG

SVG Intro

SVG Intro 15 Full intro can be found on Mozilla Developer Network. <svg version="1.1" width="300" height="300" xmlns="http://www.w3.org/2000/svg"> <rect x="40" y="30" width="200" height="200" rx="20" fill="red" stroke="black" stroke-width="2" /> <rect x="80" y="60" width="200" height="200" rx="40" fill="blue" stroke="black" stroke-width="2" fill-opacity="0.7" /> </svg>

16 SVG Basic Elements Rectangles: rect Circle: circle Ellipse: ellipse Line: line Polyline: polyline Polygon: polygon Path: path Group: g Attributes Position (0, 0) at topleft: x y Size: width height Stroke (color): stroke stroke-width stroke-opacity Fill (color): fill fill-opacity But specify each element one by one is hard.

17 SVG style can be specified by CSS <svg> <rect class="myrect"... /> <rect class="myrect" id="upper"... /> </svg><style>.myrect { fill: red; stroke: black; stroke-width: 2px; } #upper { fill: blue; fill-opacity: 0.7; } </style>

18 Use CSS3 interaction ability <style>.myrect:hover { fill: white; stroke: green; stroke-width: 10; transition: 0.75s; } </style> So you get an interactive SVG!

19 SVG Interaction Summary Build SVG plot from basic elements Label elements with class and id name Use CSS and JS to provide interaction or manipulation Embed your figure into a web page. Done We don't even need D3.js or other 3rd party tools here! For embedding problem, see comparison here

grid Intro

21 R Graphics Toolchain Adapted from gridsvg project page Today we focus on ggplot2 here ggplot2 builds on top of grid To export to SVG, one can through either native grdevices gridsvg

22 What's grid We stress two main component today: Viewpoint (somewhat like g of SVG) Plotting elements (e.g., points, rect, text) Every viewpoint has its coordinate system Viewpoint is buttom-up but g is top-down Show the concept by a quick demo.

23 library(grid) grid.newpage() pushviewport(plotviewport(c(5, 4, 2, 2))) pushviewport(dataviewport( pressure$temperature, pressure$pressure, name="plotregion" )) grid.points( pressure$temperature, pressure$pressure, name="datasymbols" ) # upper figure grid.rect(gp=gpar(fill=0)) grid.xaxis() grid.yaxis() # lower figure

24 grid.edit("datasymbols", pch=10) upviewport(1) # inner grid.rect(gp=gpar(lty="dashed", fill=0)) upviewport(1) # outer grid.rect(gp=gpar(lty="dotted", fill=0)) # upper plot downviewport("plotregion") grid.text( "Pressure (mm Hg)\nversus\nTemperature (Celsius)", just="right", x=unit(250, "native"), y=unit(600, "native") ) # lower plot

25 Further Reading Cannot not fully cover grid today Follow R Graphics 2nd, Paul Murrel Detailed illustration about traditional R plotting functions, grid system, lattice and ggplot2

26 ggplot2 to SVG Using grid to export to SVG is just a filename away. require("ggplot2") g <- qplot(clarity, data=diamonds, fill=cut, geom="bar") ggsave(file="ggplot2_direct.svg", plot=g, width=10, height=8)

27 Direct SVG Result Work like a charm Convert all words into outline Generated SVG loses original grid structure Hacking this SVG is slightly harder

28 girdsvg Intro gridsvg parse the grid structure then export to SVG directly Also, it provides some helper function to create animation Demo from gridsvg intro More examples hosted on Shiny by timelyportfolio g <- ggplot(...) +... # plot your ggplot2 here g.svg <- grid.export("demo.svg", addclasses=true)

29 (The text is selectable) 30 20 cond yvar 10 A B 0-5 0 5 10 15 20 xvar

Summary

31 Our try on interactive visualization is... Make SVG in R the hard way : ) Utilize ordinal R(ggplot2, lattice) plots And make SVG interactive by hand adding custom CSS and JS Pretty much based on our knowledge about CSS and JS Like this approach?

32 Limitation of this approach We are dealing with the front-end. Not R itself It is hard. Harder when you are dealing with chinese text and complicated coordinate system However, getting our hands dirty, we learn some fundamental architecture for R graphics What's next? We mentioned two ways about interactive visualization in R.

33 Generate an interactive R plot directly Package-dependent implementation. All generates R plots through HTML, SVG, JS, CSS. rcharts: provide lattice-like interface googlevis: communicate with Google Chart API recharts: R interface to ECharts for data visualization ggvis: next-generation ggplot2 based on JS lib Vega, also facilitates HTML5 Canvas

34 Take home message Do interactive visualization on web How to write SVG on our own Get some insight about R graphics ecosystem Turn current grid-based R plots into SVG Future

Thank You!