4 ms·
This is a pretty effective guide for the custom features that ggplot2 excels at, namely faceting. That being said, optimizing the chart requires a few more step
by minimaxir 11y ago
This is a pretty effective guide for the custom features that ggplot2 excels at, namely faceting. That being said, optimizing the chart requires a few more steps in each case, especially when working with real world data.
For those who want a step-by-step guide on plotting with ggplot2, I wrote a tutorial that has been well-liked with an emphasis on making pretty charts: http://minimaxir.com/2015/02/ggplot-tutorial/ http://minimaxir.com/2015/02/ggplot-tutorial/
Yesterday, I also pushed a screencast working explicitly with R and ggplot2, with an emphasis on processing/organizing data for charting in ggplot2: http://minimaxir.com/2015/12/lets-code-1/ http://minimaxir.com/2015/12/lets-code-1/
TL;DR R/ggplot2 can be very fussy, but when it isn't, it's magical.
- semi-extrinsic 11y agoIn your tutorial you recommend rendering charts on OS X in order to get proper antialiasing. Isn't it easier to render to a vector format and then batch rasterize outside R with e.g. ImageMagick? Or even better, just use the vector format?
- minimaxir 11y agoThat workflow is neither the most user-friendly nor the most web-friendly. SVGs don't have the same flexibility and compatibility as PNGs yet, unfortunately.
- davidkretch 11y agoOn Windows, use ggsave, or if not using ggplot2, use Cairo. Linux's png output device has antialiasing.