Home » Uncategorized

Grouping Points: Drawing polygons around groups of points in ggplot

This article was written by Luis Verde Arregoitia on his personal research page.

2808319228

For various kinds of analyses, we often end up plotting point data in two dimensions for two or groups. This includes Principal Component Analyses, bioclimatic profiles, or any other combination of values on two axes. In some of my recent projects I’ve encountered three alternatives for drawing polygons around groups of points and I want to share code and examples for all three in this post.

These methods are for ggplot, but I assume there are ways to do the same things using base or other plotting engines. I wanted to use real data, so the following examples use data from thispaper on the physiology of the Japanese quail. After loading (or installing if necessary) the required packages and downloading the data directly from Dryad, we can wrangle the data so we can plot length and mass data from several individual birds at 30 vs 40 days of age.

2808320462

To read more, click here

DSC Resources

Follow us on Twitter: @DataScienceCtrl | @AnalyticBridge