As a follow up to this extremely useful question and answer:
Color-coding 95% confidence ellipses for centroids
I have manage to successfully overlay confidence ellipses for my NMDS plots in ggplot. I want now to specify the colour and shape of the data points on the plot, and the colour and linetype of the ellipses, to distinguish between my four treatments.
NMDS is here:
Dat2 is here:
The code I have tried is as follows:
ggplot(data = NMDS, aes(MDS1, MDS2)) + geom_point(aes(color = group)) +
geom_path(data=Dat2, aes(x=NMDS1, y=NMDS2,colour=group), size=1, linetype=2)+theme(axis.title.y=element_text(size=rel(1.1),vjust=0.2),axis.title.x=element_t ext(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"))
Unfortunately, only the colour of the points and ellipses seems to work - the linetype of the ellipses and the shape of the datapoints doesn't seem to change. Does anyone have a suggestion as to how to get around this?
Many thanks!