How to Write Functions to Make Plots with ggplot2 in R

Scatter Plot with a lot code repetition

Okay here is a confession. Often I preach writing functions to simplify life at work. Although I try to follow the “writing functions” mantra decently, there is a grey area where I don’t use functions that much. Any guesses? Often make tonnes of exploratory plots with ggplot2 with tons of repetition of code with slight… Continue reading How to Write Functions to Make Plots with ggplot2 in R

15 Tips to Customize lines in ggplot2 with element_line()

Tips to Customize line elements in ggplot2

As part of understanding and fine tuning ggplot2’s theme elements, we will focus on the anatomy of line elements and see 15 tips to control them with ggplot2’s theme system. With ggplot2’s theme system we can control the “non-data” elements of a plot made with ggplot2. ggplot2’s theme system comes with multiple element_ functions, element_text()… Continue reading 15 Tips to Customize lines in ggplot2 with element_line()

10 Tips to Customize Text Color, Font, Size in ggplot2 with element_text()

Tips to Customize Text in ggplot2 plot with element_text()

ggplot2’s theme system give us a great control over how the “non-data” elements of a plot should look like. The theme system helps elevate the plot you make by making finer changes and make it easy to look better. ggplot2’s theme system comes with multiple element_ functions, element_text() element_line() element_rect() element_blank() And they help control… Continue reading 10 Tips to Customize Text Color, Font, Size in ggplot2 with element_text()

New Version of Patchwork is Here: Inset a plot inside a plot

Insetting plots with Patchwork in R

A new version of the R package Patchwork is available on CRAN. If you are not familiar with the Patchwork, it is a R package developed by “one and only” Thomas Lin Pedersen and it makes it possible to combine multiple plots made with R either ggplot2 or base R into a single graphics. As… Continue reading New Version of Patchwork is Here: Inset a plot inside a plot

ggplot2 3.3.0. Is Here : Two New Features You Must Know

ggplot2, the R package that lets you create graphics using the Grammar of Graphics has a new version. The new version of ggplot2; version 3.3.0 has lots of changes and it available on CRAN. Introducing ggplot2 v 3.3.0 Thomas Lin Pedersen says that the new version “is packed with features, big and small” and a… Continue reading ggplot2 3.3.0. Is Here : Two New Features You Must Know