In this post, we will learn how to remove legend of a plot made with ggplot2 in 4 different ways. Adding legend to a plot is often helpful to easily understand a plot. However there are scenarios legends can be redundant or we don’t need them. In ggplot2, we have multiple options to remove legend… Continue reading Multiple ways to remove legend in ggplot2
Category: R
How to reverse legend key order in ggplot2
In this tutorial, we will learn how to reverse the order of legend keys in ggplot2. In ggplot2, when we color by a variable using color or fill argument in side aes(), we get a legend with keys showing which keys match which colors. Here we will show how to reverse the order of legend… Continue reading How to reverse legend key order in ggplot2
How to Increase Legend Key Size in ggplot2
In this tutorial, we will learn how to increase the color legend’s point (or legend key) size in ggplot2. Often when you make a plot with multiple groups and large number of data points, the legend key for the color variable are small and can be not legible in the plot. Here we will see… Continue reading How to Increase Legend Key Size in ggplot2
Lollipop plot with ggplot extension ggalt
In this tutorial, we will learn how to make lollipop plot using ggalt, one of the ggplot2 extension packages. A lollipop plot is a great alternative for bar plot as the amount ink used to make the lollipop plot is much smaller. ggalt, R package developed by @hrbrmstr, has a geom for making lollipop called… Continue reading Lollipop plot with ggplot extension ggalt
How to encircle a set of points in R with ggplot2
In this post, we will learn how to encircle data points with ggplot2. In R, there are multiple ways to highlight/annotate data points. Here we will use, ggalt, one of the ggplot2 extension packages to encircle data points. ggalt‘s geom_encircle() function can automagically encircle points belonging to multiple groups. Setting data and packages First, let… Continue reading How to encircle a set of points in R with ggplot2