Introduction to Color Palettes in R with RColorBrewer

RColorBrewer color blind friendly palettes

RColorBrewer is a R package based on colorbrewer2.org that offers a variety of color palettes to use while making plots in R. Choosing which colors to use while making data visualization is not an easy task. In this tutorial we will see the basics of color palettes available with RColorBrewer package. A Color palette is… Continue reading Introduction to Color Palettes in R with RColorBrewer

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

5 tips to make better histograms with ggplot2 in R

Histogram with density line in ggplot2

Histograms are of great use to visualize a uni-variate distribution. As ggplot2 defines, histograms “Visualise the distribution of a single continuous variable by dividing the x axis into bins and counting the number of observations in each bin.” ggplot2’s geom_histogram() function displays the counts as bars and it also makes it easy to customize histograms… Continue reading 5 tips to make better histograms with ggplot2 in R

Exit mobile version