我尝试使用scale_colour_discrete
. 这里出现了类似的问题
p <- ggplot(myData, aes(myFeature1,myFeature2))
p <- p + geom_point(aes(colour = myFeature3)) + facet_grid(n ~ cond)
p <- p + scale_colour_discrete(breaks = levels(myData$myFeature3), labels = c(expression(myFeature3[1]),expression(myFeature3[2]))
但是,会出现以下错误: FUN(X[[1L]], ...) 中的错误:无法将“符号”类型强制转换为“双”类型的向量
这个错误不会发生,没有在labels
定义expression
中。它确实发生在expression
.
关于这个主题的任何想法?只是不scale_colour_discrete
工作expression
吗?还有另一种方法可以将下标添加到这些图例因素名称中吗?
非常感谢!