4 ms·
Interesting project, and surely a great showcase of R graphic capabilities. For somebody like me coming from python/matplotlib, which gives almost unlimited fre
by gghh 9y ago
Interesting project, and surely a great showcase of R graphic capabilities. For somebody like me coming from python/matplotlib, which gives almost unlimited freedom in creating complex visualizations, when approaching R graphing should I focus on basic R ("graphics" package) or learn some ggplot2?
At first it looked like basic graphics is quite limited, but after I learned that I can draw rectangles and polygons I re-evaluated it a lot. OTOH I can't avoid the feeling that all ggplot2 gives me is some canned styles and a very uncomfortable syntax, like "ggplot(...) + geom_bar(...) + theme(...)" where `+` means something I can't fully comprehend (because "The Grammar of Graphics").
Please help me change my mind if I'm being ill-informed, I do want to take the most I can from R graphing. ggplot2 is hugely popular so it must be doing something right.
- stared 9y agoFor practical plots ggplot2 is awesome. For having full freedom of drawing anything, it's impossible to beat D3.js (neither graphics in R nor matplotlib in Python gives is comparable).
- Tarq0n 9y agoFor most everyday plotting tasks freedom is overrated. What ggplot gives you is unparalleled productivity, combined with a 'grammar of graphics' API that makes it very pleasant to specify and experiment with visualizations. It's also easy to make ggplot look publication ready with little effort. If you need something highly customized it can be quite a bit of work, but at least in my experience you almost never do.
- nerdponx 9y agoThe + should just be taken to mean "add this layer to your plot". It's building up a graph object, whose print() method happens to also be its plot() method. Basic graphics are actually tremendously powerful and can basically give you pixel level control. However the documentation is trash and many of the higher-level functions have hideous defaults. Ggplot is great for fast iteration and exploratory data analysis, especially when "coloring by group" and "faceting" are involved.
- jhbadger 9y agoThe problem in basic R graphics is that you basically spend all your time messing with margins and font sizes and the like. Not that there's no fiddling with ggplot2, but it's much better at not generating graphs with all your labels overlapping. Literally the only time I use basic graphics is for heatmaps (all the major packages still seem to use basic graphics for those for some reason). Ggplot2 may not be "intuitive", but it definitely is worth learning. And it isn't just an R thing anymore -- ggplot2-inspired graphics systems are beginning to be created for lots of other programming languages these days.