# NOT RUN {
# parallel coordinate
p <- ggplot(iris, mapping = aes(Sepal.Length = Sepal.Length,
Sepal.Width = Sepal.Width,
Petal.Length = Petal.Length,
Petal.Width = Petal.Width,
colour = Species))
p + geom_serialaxes()
# radial coordinate
p +
geom_serialaxes() +
coord_radial()
# andrews plot
p + geom_serialaxes(stat = "dotProduct",
transform = andrews) # default
# Legendre polynomials
p + geom_serialaxes(stat = "dotProduct",
transform = legendre)
# or set the `axes.sequence` rather than the mapping `aes`
p <- ggplot(iris) +
geom_serialaxes(axes.sequence = colnames(iris))
p
# }
# NOT RUN {
############# Determine axes sequence
# 1. set the duplicated axes by mapping aesthetics
ggplot(iris, mapping = aes(Sepal.Length = Sepal.Length,
Sepal.Width = Sepal.Width,
Sepal.Length = Sepal.Length,
Sepal.Width = Sepal.Width,
colour = Species)) +
# only two axes, duplicated axes are removed
geom_serialaxes()
# 2. set the duplicated axes by axes.sequence
ggplot(iris, mapping = aes(colour = Species)) +
geom_serialaxes(
axes.sequence = c("Sepal.Length", "Sepal.Width",
"Sepal.Length", "Sepal.Width"))
# }
Run the code above in your browser using DataLab