Open iferuzan opened 7 years ago
I know this question was asked over a year ago, but I was having a similar issue so I'll put the solution in case anyone in the future needs it.
pcoaord + stat_ellipse(aes(lty=factor(location)), type = "t", level = 0.95) + scale_linetype_manual(values=c(1,2)) + theme_bw()
for your code I would put: lty=factor(Treatment))
and follow it with scale_linetype_manual(values=c(1,2,3)
or whatever you would want the line types to be.
Hi,
I am trying to change the line types for the ellipses based on my Treatments. Here are the commands I am using:
PCG.ord <- ordinate(PCG, "PCoA") p1 = plot_ordination(PCG, PCG.ord, type="samples", shape="Treatment", title="PCG") p1 + geom_point(size=2) + ggtitle("PCG") + theme(plot.title = element_text(hjust = 0.5)) + xlab("PC1") + ylab("PC2")+ scale_shape_discrete(breaks=c("Initial Time","10 Weeks Control","10 Weeks Treatment")) + stat_ellipse(type="norm")
Again, my problem is that I am trying to have different ellipse linetypes for my three Treatments (Initial Time, 10 Weeks Control, and 10 Weeks Treatment). Is there a way to do this? I tried using scale_linetype_manual but could not get it to work...
Any help is much appreciated!