You need to map linetype
and shape
to group
, just as you mapped color
to group
. You can actually do both of these mappings once in the first line, since the name of the variable is the same across your two datasets:
ggplot(data = NMDS, aes(MDS1, MDS2, color=group, linetype=group, shape=group))
Of course, then you need to delete the color
and linetype
mappings elsewhere. You also should specify the linetype
values in scale_linetype_manual
as numbers, not strings. In the end, you'll have something like this:
ggplot(data = NMDS, aes(MDS1, MDS2, color=group, linetype=group, shape=group)) +
geom_point() +
geom_path(data=Dat2, aes(x=NMDS1, y=NMDS2), size=1) +
theme(axis.title.y=element_text(size=rel(1.1),vjust=0.2),axis.title.x=element_text(size=rel(1.1),vjust=0.2),axis.text.x=element_text(size=rel(1)),axis.text.y=element_text(size=rel(1)),text = element_text(size=13)) +
scale_shape_manual(name = "Treatment", labels = c("W+N-", "W+NC", "WCN-", "WCNC"), values = c(17, 19,17, 19)) +
scale_colour_manual(name = "Treatment", labels = c("W+N-", "W+NC", "WCN-", "WCNC"), values = c("blue", "blue","red", "red")) +
scale_linetype_manual(name = "Treatment", labels = c("W+N-", "W+NC", "WCN-", "WCNC"), values = c(3, 1,3, 1))