Spider and parallel charts in R with the ggvanced bundle

An R bundle for efficient visualization of a number of variables

A fairly spider chart. Picture by Writer.

Throughout one in all my knowledge evaluation tasks, I discovered myself in want of an efficient option to evaluate teams throughout a number of variables without delay. After all, bar charts got here to thoughts first, however I wished one thing extra eye-catching, one thing extra fascinating. After looking the online a bit, I settled on two prime candidates — a spider chart and a parallel chart.

After this, I normally simply discover a devoted R bundle producing the wanted visualizations, however this time, this method left me empty-handed.

A LIE — extra skilled R customers would possibly say! Such visualizations can already be obtained utilizing packages similar to fsmb and ggradar for radar charts and ggally for parallel plots.

Nevertheless, other than simply performing the ranked comparability of teams throughout variables, I additionally wished to concurrently show the vary of values for every variable. And, you guess it, not one of the aforementioned packages provided this. So, I made a decision to construct my very own 🙂

ggvanced is an R bundle for creating superior multivariable plots similar to spider/radar charts and parallel plots. The visualizations are created on high of the ggplot2 bundle. The fantastic thing about the ggplot2 bundle is the underlying grammar of graphics, permitting for creation of graphs by stacking a number of layers on high of each other. This highly effective idea lets us create basically any visualization, so long as we all know learn how to code it.

A schamatic depiction of how ggplot2 charts are made. Image by
Zvonimir Boban.
Creating visualizations utilizing the grammar of graphics method. Picture by Writer.

The bundle is at present available on GitHub and will be put in by typing the devtools::install_github("Ringomed/ggvanced") command in R and calling library(ggvanced) afterwards.

If you’re within the particulars of chart building, in a current put up I confirmed the logic behind establishing a spider chart from scratch, so take a look at the story beneath or the detailed documentation on GitHub.

For the remainder of you, beneath are some examples detailing what the bundle capabilities can do.

The ggspider() operate creates spider charts which both a single shared axis scaled to a [0,1] vary, or a separate axis with actual values displayed for each displayed class. Let’s take a look at the operate on a few examples. First, we’ve got to format the info in order that the primary column comprises the group identifier, and different columns the descriptory variables. We’ll use the built-in mtcars and iris datasets.


mtcars_summary <- mtcars %>%
tibble::rownames_to_column(var = "group") %>%
tibble::as_tibble() %>%

iris_summary <- iris %>%
dplyr::group_by(Species) %>%
dplyr::summarise(throughout(the whole lot(), imply))

Evaluating automotive properties

Picture by Writer.

The important thing variations between the vehicles instantly stand out. As anticipated, in comparison with racing vehicles such because the Ferrari and Maserati, the Volvo has a lot much less horsepowers (hp) and takes for much longer to cowl 1 / 4 of a mile (qsec), however can be way more economical by way of miles per gallon (mpg).

Visualizing variations bettween the Iris species

Picture by Writer.

Identical to with the vehicles instance, the spider chart could be very efficient for figuring out the variations between the iris species. We are able to instantly see that the Versicolor and Virginica species are way more related, having essentailly the identical ratios of petal and sepal lengths and widths and solely differing within the whole flower dimension. Conversely, the Setosa species has a a lot bigger sepal width.

Radar charts

The operate additionally permits for creation of conventional radar charts with a single widespread scaled axis by specifying the argument scaled = TRUE and switching to a spherical form utilizing polygon = FALSE.

ggspider(iris_summary, scaled = TRUE, polygon = FALSE)

The opposite operate arguments are extra aesthetic in nature, and canopy elements similar to font dimension, place of the labels and so forth. For extra particulars, check with the operate documentation.

Though I favor spider charts from an aesthetic viewpoint, parallel charts could make it simpler to identify traits throughout variables. That is very true when there are numerous variables or observations within the dataset.

Picture by Writer.
Picture by Writer.

The above charts are simply barebone model. After all, they are often “pimped up” identical to another ggplot2 chart. Under is an instance of a ggvanced spider chart after a few alterations.

Picture by Writer.

And naturally, the accompanying code. Take pleasure in! 🙂


sysfonts::font_add_google("Roboto Condensed")

mtcars_gr <- mtcars %>%
tibble::rownames_to_column(var = "group") %>%
tibble::as_tibble() %>%
tail(3) %>%
rename("Miles per Gallon" = mpg, "Cylinders" = cyl,
"Displacement" = disp, "Horsepower" = hp,
"Rear axlen ratio" = drat, "Weight" = wt) %>%

ggspider(mtcars_gr, axis_name_offset = 0.15, background_color = "beige", fill_opacity = 0.15) +
labs(col = "Automobile identify", title = "Evaluating Automobile Properties") +
theme(plot.title = element_text(hjust = 0.475, face = "daring"),
legend.title = element_text(face = "daring"),
textual content = element_text(household = "Roboto Condensed", face = "daring"))

On this put up, I lined key capabilities and choices of ggvanced — a bundle I made in response to a necessity for extra superior spider and parallel charts in R.

The textual content goes by a few examples for every operate after which present how the ultimate outcome can appear like after some extra customization.

I hope that the bundle might be helpful to you as it’s to me. If in case you have requests for any extra customized visualizations to be applied in R, please drop a remark, and I’ll do my finest to create a separate operate for it. 🙂

7 Greatest Resume Builder AI Instruments

Rotating On-Name for Operational and Assist: A Should for Information Groups | by Benjamin Thürer | Jun, 2023