By ndphillips
Hello fellow R pirates! For those of you who didn’t see it, I recently wrote a post demonstrating the pirateplot() function in the yarrr package. The pirateplot() function replaces the deceptive (and boring) bar plot with a full RDI plot, capable of plotting Raw data (and smoothed densities), Descriptive statistics (like means and medians), and Inferential statistics (a 95% Bayesian Highest Density Interval “HDI”).
In the past 48 hours I’ve had an overwhelmingly positive response to the pirateplot() function. At the same time, I received several great recommendations for tweaks and improvements to the function to make it even better. After consulting the original pirate text, I decided that the changes stay true to the original piratery intent of the pirate plot. I’m sure the founding members of the pirate plot would be proud.
Let’s go over the changes! To use the latest version of the pirateplot() function, be sure to install the latest version of the yarrr package:
# install.packages("devtools") # Only if you don't have the devtools library already installed library("devtools") install_github("ndphillips/yarrr")
Once you’ve installed the latest version, load the package with library()
library("yarrr")
Now you’re ready to make some pirate plots! Here are the major updates to the function:
Opacity Themes
The five critical aspects of a pirate plot are the bars, beans, points, (average) lines, and hdis. You can adjust the opacity of each of these elements with opacity arguments — such as bars.o, beans.o (etc.).
The biggest update to pirateplot() is the addition of opacity themes which are designated by a new argument called theme.o. The input to this argument defines an opacity theme across all five elements. Themes 1, 2, and 3 create specific opacity values for each of the elements, while Theme 0 sets all opacities to 0. Thankfully, the themes just set default values for the individual element opacities — you can still …read more
Source:: r-bloggers.com