Adding percentage labels or count labels to bars in a barplot can help read the barplot quickly. In this tutorial, we will learn how to add labels with percentage symbol on bars in a barplot made with ggplot2 in R. Loading Packages and Dataset Let us get started by loading packages needed and a dataset… Continue reading How to add percentage label on bars in barplot with ggplot2
Grouped Boxplots with reproducible jittered data points
In this post we will learn how to make a grouped boxplots with reproducible jittered points. We can make a grouped boxplot with jittered points using position_jitterdodge() function as position argument to geom_point(). Note that using the handy wrapper function geom_jitter() instead of geom_point() with position_jitterdodge() will not give right plot with jittered data. If… Continue reading Grouped Boxplots with reproducible jittered data points
How to Add Vertical/Horizontal Lines to Subplots with Seaborn
In this tutorial, we will learn how to add vertical or horizontal lines to “small multiples” i.e. multiple subplots of similar kind using Seaborn’s refline() function (h/t to Chris Moffitt of @pbpython). Vertical/Horizontal lines are often useful to show where the mean or median values of the variables of interest and in a simple plot… Continue reading How to Add Vertical/Horizontal Lines to Subplots with Seaborn
How to make random jittered points reproducible
In this post we will learn how to make a random jitter plots made with ggplot2 reproducible. We have multiple posts on the importance of showing the actual data points while making boxplots/violinplots. One of the ways to avoid overplotting, is to add random jitters on the x-axis to the data points, so they all… Continue reading How to make random jittered points reproducible
Direct Labeling on line plots with geomtextpath
Labeling a plot greatly help understand the gist of a plot easily. ggplot2 offers a number of ways to add text labels to a plot. Often directly adding the labels on a plot instead of having a legend is a better option. The R package, geomtextpath, a ggplot2 extension package offers a nice solution and… Continue reading Direct Labeling on line plots with geomtextpath