3 ms·
Using a very, very simplistic chart and dataset for comparing base graphics and ggplot2 is cheating a bit. Base graphics can become extremely unwieldy when deal
by minimaxir 11y ago
Using a very, very simplistic chart and dataset for comparing base graphics and ggplot2 is cheating a bit. Base graphics can become extremely unwieldy when dealing with nonunivariate data, especially if you want specific theming.
The ggplot2 code is not formatted one-function-per-line like the base code. It may be slightly more LoC for base graphics, but it's very clear what is happening with the ggplot2 and design, which is a far more important attribute than LoC.
- jpatrick 11y agoI think intermediate-complexity graphics are where ggplot2 excels. If you want to do something like plot a bunch of small multiples, you'll have a much better time of it using facet_grid than wrangling with base graphics. Once your graph reaches a certain level of complexity, though, or requires a certain degree of customization, I think base graphics regain the edge. At that point I prefer the level of control you get by drawing things from scratch with points(), lines(), text(), etc.