5 ms·
The ggplot flipbook – building charts slowly
- sk5t 8y agoWonderful demonstration. I can't help but wonder--as someone who has flirted with R but certainly not committed--how much time and practice it takes to acquire decent fluency with these half-magical incantations to become productive.
- jhbadger 8y agoNot that long. The trick is to really understand what each clause is doing. It's easy to just find some code on the Web for a graph similar to what you want and tweak it for your data, and I did that myself in the beginning, but then they will remain "half-magical incantations" as you put it. The thing about ggplot is nothing is there arbitrarily -- it is really describing how the plot is put together.
- dswalter 8y agoThe other thing is that the 'gg' in ggplot2 is the Grammar of Graphics, which describes a high-level grammar for composing visualizations. Having an underlying grammar makes it possible for the syntax to have logical consistency, where once you learn how it works, you can incorporate and generalize simply. (aside, I used to use ggplot2 but I switched to working in python, and I miss ggplot2 so, so much). The syntax being shown here demonstrates an incremental way of layering on the components of the final visualization, which shows the power of the underlying grammar of graphics.
- hprotagonist 8y agoHave you tried plotnine? The api is effectively identical.
- devit 8y agoYou can use R packages from Python and viceversa with rpy2 or reticulate.
- Gatsky 8y agoIt depends on what you want to do. ggplot2 is what I would describe as broad but not deep - you can access 90% of the functionality in a relatively short time. The main thing is that ggplot2 has been around for a long time, is developed by people that care a lot about R, and there is pretty much an answer to any question you may have on stackoverflow.
- neves 8y agoggplot2 also have excellent defaults. I'm really in Visualizations but I'm from the Python world. I had to teach a class using ggllot2 and was really impressed. You can easily make excellent graphs.
- black-tea 8y agoThis is ggplot. It's not a good example of what it's like to use R in general. I sorely wish there was a well-maintained ggplot for Python because the library is excellent but the language is terrible.
- amrrs 8y agoBBC internally created a cookbook for the same purpose. https://bbc.github.io/rcookbook/ https://bbc.github.io/rcookbook/ I think it's okay that if someone's fluent in R and yet don't know how to update scales in ggplot.
- fxfan 8y agotangential but what software were slides created in?
- chaosbutters 8y agosuper cool, well done! love to see this for other language and plotting
- black-tea 8y agoThis is a great demonstration and shows the bit that finally clicked with me. When you learn to wield these tools you'll be considered a wizard by many when you're able to make beautiful plots in seconds.
- ppod 8y agoReally great examples. Anyone got any updates on what the best python equivalent is? Bokeh? Plotly?
- p10_user 8y agoBokeh and Plotly produce dynamic, javascript based visualizations. ggplot is for static images, which matplotlib is the obvious counterpart in Python. There are notable packages built on top of matplotlib including seaborn and plotnine.
- rrggrr 8y agoSeaborn. It is fabulous. I use it regularly. https://seaborn.pydata.org/ https://seaborn.pydata.org/
- kot-behemoth 8y agoR's ggplot2 follows The Grammar of Graphics. The closest and best implementation of it in Python is Altair (https://altair-viz.github.io https://altair-viz.github.io). It's a fairly young library, but is very simple to use, and can do really powerful things (see the last chart here https://altair-viz.github.io/case_studies/exploring-weather.html https://altair-viz.github.io/case_studies/exploring-weather....)
- closed 8y agoI would say hands down, plotnine. It... * is a port of ggplot2 to python * has a very active maintainer I've been testing out porting a bunch of analyses from R to python, and it has been very easy to swap in for ggplot2. The biggest downside I can see is that with ggplot2 it's easy to convert to interactive using plotly (but there isn't that kind of support for plotnine yet). https://github.com/has2k1/plotnine https://github.com/has2k1/plotnine
- WiertOmta 8y agoThis is exactly what I was looking for all weekend, great! Thanks!
- stronglikedan 8y agoIs there a flipbook format that doesn't break content zooming?
- philipodonnell 8y agoVery nice. I would love some kind of plugin for Rstudio that let you "play" through an arbitrary ggplot like this to help understand how charts are built.
- mushufasa 8y agoThe people of RStudio often produce lessons for DataCamp, which has interactive browser-based lessons on how to use ggplot like https://www.datacamp.com/courses/data-visualization-with-ggplot2-1 https://www.datacamp.com/courses/data-visualization-with-ggp... (first chapter free). Is that helpful?
- philipodonnell 8y agoI was thinking more like an automatic way to step through each subsequent "+"'d function rather than having to comment/uncomment repeatedly to isolate what each layer does.
- cdaringe 8y agoggplot2's ultra terse, beautiful charts really beat out the competition. I do wish the api's were _less compact_ and more naturally explorable right out of the ide. R as a whole suffers these traits imho. I hope ggplot is ported to the RoW, ideally a typed language or runtime