Visualizing clusters using Hull Plots in ggplot2 using ggforce
The HULL Plots are also known as Grouped Scatter Plots because these plots are used to segregate the scatter plots based on clusters. The Hull plots are much more useful when one wants to visualize the clusters present among the data. The Hull plots in R can be plotted using the geom_mark_hull() function which is present in ggforce package.
Syntax of geom_mark_hull() method
- mapping – set of aesthetic mappings created by aes() function
- data – The data frame to be displayed
- concavity – used to set the concavity of thehull
- radius – used to specify corner radius
- position – used to adjust the position.
Steps to Visualize Clusters using Hull Plot
Step 1: First, we need to install the required packages (ggplot2, ggforce) and load them.
Step 2: Next we need to plot the basic scatter plot using ggplot() function in the ggplot2 package.
Step 3: Later we will add hulls(clusters) to that scatter plot using geom_mark_hull() function in ggforce package.
Step 4: We can also customize the Hull Plot in R using labs() function of ggforce package to add labels to the plot and using expand_limits() we can expand the limits of the x and y axes values that need to be considered to plot the graph.
Please Login to comment...