How To Color Scatter Plot by Variable in R with ggplot2?

Scatter Plot R: Fill color by variable

In this post we will learn how to color scatter plots using another variable in the dataset in R with ggplot2. Scatter plots are extremely useful identify any trend between two quantitative variables. However, often you have additional variable in a data set and you might be interested in understanding its relationship. One way to… Continue reading How To Color Scatter Plot by Variable in R with ggplot2?

How To Color Boxplots By a Variable in R with ggplot2?

Filling boxplot with colors using geom_boxplot()

In this tutorial, we learn how to color boxplots in R by a variable. With ggplot2 in R, we can color boxplots in multiple ways. In this post, we will first see how to make a simple boxplot in R. And then we will learn how to fill the boxes on boxplot by a variable.… Continue reading How To Color Boxplots By a Variable in R with ggplot2?

How To Add Mean Line or Vertical Line to Density Plot with ggplot2?

Density Plot in R with Mean Line and Text Annotation

Adding a vertical line on mean or median value of a distribution to its density plot can make understanding the plot easier. In this post, we will first see a simple example of adding mean line to a density plot using ggplot2 in R. And then we will also see an example of adding a… Continue reading How To Add Mean Line or Vertical Line to Density Plot with ggplot2?

How To Make Density Plots with ggplot2 in R?

Density Plot with log scale

In this tutorial, we will see how to make density plots with ggplot2 in R. We will start with an example of making a basic density plot with ggplot2 and see multiple examples of making the density plots better. Let us load tidyverse, a suite R packages from RStudio and also set the default theme… Continue reading How To Make Density Plots with ggplot2 in R?

How to Combine Multiple ggplot2 Plots? Use Patchwork

Combining Multiple Plots

When you have made great data visualizations often you have to combine the plots into a single figure. Thomas Lin Pedersen from RStudio has made a fantastic R package to combine the plots. In his words, The goal of patchwork is to make it ridiculously simple to combine separate ggplots into the same graphic. As… Continue reading How to Combine Multiple ggplot2 Plots? Use Patchwork

Exit mobile version