In this tutorial, we will learn how to wrap a really long labels in a facet plot made with ggplot2 using facet_wrap(). When the facet labels are too long, the label text gets cuts off. Here we will learn how can we fold or wrap the long facet labels into multiple lines so that the… Continue reading How to wrap really long facet label in R
Author: datavizpyr
How to make stacked barplot with percent on x/y axis
In this post we will see how to make a stacked barplot showing percentage on its axis instead of count or proportion. We can make stacked barplot with count or proportion directly using geom_bar() function in ggplot2. Then we will use scales R package to add percentage on the axis instead of proportion. Let us… Continue reading How to make stacked barplot with percent on x/y axis
Visualizing Correlation with tidymodels’ corrr package
In this tutorial, we will learn examples of computing correlations among all the numerical variables in a dataframe and visualize the correlation in multiple ways. We will use Corrr package from tidymodels to compute the correlation and visualize the correlation. corrr is a package for exploring correlations in R. It focuses on creating and working… Continue reading Visualizing Correlation with tidymodels’ corrr package
ggplot2 error: how to fix error in dataframe
In this post we will learn under what circumstances we will see a ggplot2 error that says something like “replacement has 9 rows, data has 8” in addition to other text that is not easily understood. We will also see an easy fix to such a difficult sounding error. Let us say we are trying… Continue reading ggplot2 error: how to fix error in dataframe
Correlation Dot Plot with Error Bar
In this tutorial, we will learn how to compute correlation of one variable against multiple variables and make a plot showing the correlation values with error bars. This nice trick uses map() functions from purrr package to compute multiple correlations and uses broom’s tidy() function to clean up the correlation model to get the results… Continue reading Correlation Dot Plot with Error Bar