Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
ggplot for
python
Greg Lamp
ggplot
● What is it?
● Alternatives
● How it works
● Why should I use it?
● Tutorial
Here I am on
the Internet.
Founder/CTO @ Yhat
Hi, I’m Greg!
What is
ggplot?
DSL for graphics
DSL for graphics
scatterplot
histogram
labels
color
shape
What about
matplotlib?
matplotlib
syntax, api,
default themes,
learning curve
matplotlib
maturity, ipython,
customization, community
syntax, api,
default themes,
learning curve
“Facet all
things”
www.gregreda.com
matplotlib ggplot
What about
d3.js?
d3.js
ggplot
ggplot d3.js
How it works
Format
ggplot
data frame
“aesthetics”
Aesthetics
color
shape
size
...fill, alpha, slope,
intercept, ymin,
ymax, ...
Geoms,
Stats, &
Scales
geom_point
geom_area
...there are many
stat_smooth
...there are a few
scale_color_brewer
scale_color_gradient
...there are many
Layers
+
+ +
+ +
ggplot() geom_point() stat_smooth()+ +
ggplot() +
geom_point() +
stat_smooth()
Why is this
good?
Makes “reasonable
assumptions”
not real colors
matplotlib freaks
still not real colors
...but i can guess
what you mean
Concise yet
expressive
Looks pretty good
(and is easy to customize)
Seaborngithub.com/mwaskom/seaborn
Tutorial
github.com/glamp/ggplot-tutorial/
OR
http://blog.yhathq.com/posts/facebook-ggplot-tutorial.html
What’s next
http://ggplot.yhathq.com
Thanks!
@theglamp
g@yhathq.com
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
ggplot for python
Upcoming SlideShare
Loading in …5
×

ggplot for python

15,653 views

Published on

Making basic, good-looking plots in Python is tough. Matplotlib gives you great
control, but at the expense of being very detailed. The rise of pandas has made
Python the go-to language for data wrangling and munging but many people are
still reluctant to leave R because of its outstanding data viz packages. ggplot
is a port of the popular R package ggplot2. It provides a high level grammar
that allow users to quickly and easily make good looking plots. So say good-bye
to matplotlib, and hello to ggplot as your everyday Python plotting library!

Published in: Data & Analytics, Technology

ggplot for python

  1. 1. ggplot for python Greg Lamp
  2. 2. ggplot ● What is it? ● Alternatives ● How it works ● Why should I use it? ● Tutorial
  3. 3. Here I am on the Internet. Founder/CTO @ Yhat Hi, I’m Greg!
  4. 4. What is ggplot?
  5. 5. DSL for graphics
  6. 6. DSL for graphics scatterplot histogram labels color shape
  7. 7. What about matplotlib?
  8. 8. matplotlib syntax, api, default themes, learning curve
  9. 9. matplotlib maturity, ipython, customization, community syntax, api, default themes, learning curve
  10. 10. “Facet all things” www.gregreda.com
  11. 11. matplotlib ggplot
  12. 12. What about d3.js?
  13. 13. d3.js
  14. 14. ggplot
  15. 15. ggplot d3.js
  16. 16. How it works
  17. 17. Format
  18. 18. ggplot
  19. 19. data frame
  20. 20. “aesthetics”
  21. 21. Aesthetics
  22. 22. color
  23. 23. shape
  24. 24. size
  25. 25. ...fill, alpha, slope, intercept, ymin, ymax, ...
  26. 26. Geoms, Stats, & Scales
  27. 27. geom_point
  28. 28. geom_area
  29. 29. ...there are many
  30. 30. stat_smooth
  31. 31. ...there are a few
  32. 32. scale_color_brewer
  33. 33. scale_color_gradient
  34. 34. ...there are many
  35. 35. Layers
  36. 36. +
  37. 37. + +
  38. 38. + + ggplot() geom_point() stat_smooth()+ +
  39. 39. ggplot() + geom_point() + stat_smooth()
  40. 40. Why is this good?
  41. 41. Makes “reasonable assumptions”
  42. 42. not real colors
  43. 43. matplotlib freaks
  44. 44. still not real colors ...but i can guess what you mean
  45. 45. Concise yet expressive
  46. 46. Looks pretty good (and is easy to customize)
  47. 47. Seaborngithub.com/mwaskom/seaborn
  48. 48. Tutorial
  49. 49. github.com/glamp/ggplot-tutorial/ OR http://blog.yhathq.com/posts/facebook-ggplot-tutorial.html
  50. 50. What’s next
  51. 51. http://ggplot.yhathq.com
  52. 52. Thanks! @theglamp g@yhathq.com

×