7 Tips to customize rectangle elements in ggplot2 element_rect()

Anatomy of Rectangle Elements in ggplot2

Continuing the blog post series on how to control theme elements in ggplot2, in this post we will look at how to customize rectangular elements in ggplot2 using element_rect() function. ggplot2’s theme function helps us fully control the “non-data” elements of a plot made with ggplot2. ggplot2’s theme system comes with multiple element_ functions, element_text()… Continue reading 7 Tips to customize rectangle elements in ggplot2 element_rect()

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