r - dotted and solid ellipses by group for ggord NMDS plot

1k views Asked by At

I am using the code below to ask a question about using grouping to change the ellipse line types.

# to install ggord
library(devtools)
install_github("fawda123/ggord")

library("ggord")
library("vegan")
library("data.table")

irises <- iris

irises <- as.data.table(irises)

irises[, Group := as.factor(c(rep("Dotted", 100), rep("Solid", 50)))]

ord <- metaMDS(irises[, 1:4])

ggord(ord, irises$Species, poly = FALSE, vectyp = irises$Group)

For this example, I want to have setosa and versicolor represented by dotted ellipses & virginica by a solid ellipse. This is identified in the "Group" column of irises. Any suggestions?

1

There are 1 answers

1
fawda123 On BEST ANSWER

v1.1.3 includes a polylntyp argument.

library(devtools)
install_github("fawda123/ggord")

library("ggord")
library("vegan")
library("data.table")
library("ggplot2"

irises <- iris

irises <- as.data.table(irises)

ord <- metaMDS(irises[, 1:4])

p <- ggord(ord, irises$Species, poly = FALSE, polylntyp = irises$Species)
p

enter image description here

# change defaults
p + scale_linetype_manual(values = c('solid', 'solid', 'dashed'))

enter image description here