ggplot for python SV 2014

65
ggplot for python Greg Lamp

Transcript of ggplot for python SV 2014

Page 1: ggplot for python SV 2014

ggplot for pythonGreg Lamp

Page 2: ggplot for python SV 2014

ggplot

● What is it?● Alternatives● How it works● Why should I use it?● Tutorial

Page 3: ggplot for python SV 2014

Here I am on the Internet.

Founder/CTO @ Yhat

Hi, I’m Greg!

Page 4: ggplot for python SV 2014

What is ggplot?

Page 5: ggplot for python SV 2014
Page 6: ggplot for python SV 2014

DSL for graphics

Page 7: ggplot for python SV 2014

DSL for graphics

scatterplot

histogram

labels

color

shape

Page 8: ggplot for python SV 2014

What about matplotlib?

Page 9: ggplot for python SV 2014
Page 10: ggplot for python SV 2014

matplotlib

syntax, api, default themes, learning curve

Page 11: ggplot for python SV 2014

matplotlib

maturity, ipython, customization, community

syntax, api, default themes, learning curve

Page 12: ggplot for python SV 2014

“Facet all things”

www.gregreda.com

Page 13: ggplot for python SV 2014
Page 14: ggplot for python SV 2014

matplotlib ggplot

Page 15: ggplot for python SV 2014

What about d3.js?

Page 16: ggplot for python SV 2014

d3.js

Page 17: ggplot for python SV 2014

ggplot

Page 18: ggplot for python SV 2014

ggplot d3.js

Page 19: ggplot for python SV 2014

How it works

Page 20: ggplot for python SV 2014

Format

Page 21: ggplot for python SV 2014

ggplot

Page 22: ggplot for python SV 2014
Page 23: ggplot for python SV 2014

data frame

Page 24: ggplot for python SV 2014

“aesthetics”

Page 25: ggplot for python SV 2014

Aesthetics

Page 26: ggplot for python SV 2014
Page 27: ggplot for python SV 2014
Page 28: ggplot for python SV 2014
Page 29: ggplot for python SV 2014

color

Page 30: ggplot for python SV 2014

shape

Page 31: ggplot for python SV 2014

size

Page 32: ggplot for python SV 2014

...fill, alpha, slope, intercept, ymin,

ymax, ...

Page 33: ggplot for python SV 2014

Geoms, Stats, & Scales

Page 34: ggplot for python SV 2014

geom_point

Page 35: ggplot for python SV 2014

geom_area

Page 36: ggplot for python SV 2014

...there are many

Page 37: ggplot for python SV 2014

stat_smooth

Page 38: ggplot for python SV 2014

...there are a few

Page 39: ggplot for python SV 2014

scale_color_brewer

Page 40: ggplot for python SV 2014

scale_color_gradient

Page 41: ggplot for python SV 2014

...there are many

Page 42: ggplot for python SV 2014

Layers

Page 43: ggplot for python SV 2014
Page 44: ggplot for python SV 2014

+

Page 45: ggplot for python SV 2014

+ +

Page 46: ggplot for python SV 2014

+ +ggplot() geom_point() stat_smooth()+ +

Page 47: ggplot for python SV 2014

ggplot() + geom_point() + stat_smooth()

Page 48: ggplot for python SV 2014

Why is this good?

Page 49: ggplot for python SV 2014

Makes “reasonable assumptions”

Page 50: ggplot for python SV 2014

not real colors

Page 51: ggplot for python SV 2014

matplotlib freaks

Page 52: ggplot for python SV 2014

still not real colors

...but i can guess what you mean

Page 53: ggplot for python SV 2014
Page 54: ggplot for python SV 2014

Concise yet expressive

Page 55: ggplot for python SV 2014
Page 56: ggplot for python SV 2014
Page 57: ggplot for python SV 2014
Page 58: ggplot for python SV 2014

Looks pretty good(and is easy to customize)

Page 59: ggplot for python SV 2014
Page 60: ggplot for python SV 2014

Seaborngithub.com/mwaskom/seaborn

Page 61: ggplot for python SV 2014

Tutorial

Page 63: ggplot for python SV 2014

What’s next

Page 64: ggplot for python SV 2014

http://ggplot.yhathq.com

Page 65: ggplot for python SV 2014

Thanks!@theglamp

[email protected]