Adding regression line to scatter plot can help reveal the relationship or association between the two numerical variables in the scatter plot. With ggplot2, we can add regression line using geom_smooth() function as another layer to scatter plot. In this post, we will see … [Read more...] about How To Make Scatter Plot with Regression Line with ggplot2 in R?
ggplot2
How To Make Facet Plot using facet_wrap() in ggplot2?
When you have data for a variable corresponding to multiple groups, visualizing the data for each group can be useful. One of the techniques to use is to visualize data from multiple groups in a single plot. However, a better way visualize data from multiple groups is to use … [Read more...] about How To Make Facet Plot using facet_wrap() in ggplot2?
How To Adjust Title Position in ggplot2 ?
One of the annoying things while making a plot is fine tuning it the way you want. Sometimes ones of such pain points is placing the title on the plot. Till recently, ggplot2 placed title or subtitle such that it aligns with the plotting area. In this post we will learn how to … [Read more...] about How To Adjust Title Position in ggplot2 ?
How to Add Vertical Lines By a Variable in Multiple Density Plots with ggplot2
Adding vertical line or lines at mean or median of density plot can help us understand the trend in the data. When you make multiple density plots adding vertical mean/median line for each group in the same color as the density plot is of great help. In this post, we will see … [Read more...] about How to Add Vertical Lines By a Variable in Multiple Density Plots with ggplot2
How to Make Horizontal Boxplot with ggplot2 version 3.3.0?
Making a boxplot or barplot horizontally can be useful in a variety of scenarios. In ggplot2, till now the only way to make a plot horizontal is to use flip the axis using coord_flip(). With ggplot2 version 3.3.0, we can easily flip axis and make horizontal boxplot or horizontal … [Read more...] about How to Make Horizontal Boxplot with ggplot2 version 3.3.0?