R 将表达式(plotmath)放入图例键标签中

R 将表达式(plotmath)放入图例键标签中,r,ggplot2,R,Ggplot2,如何将表达式(plotmath)放入以下绘图的图例键标签中 我知道其中的内容和链接,但每当我使用scale\u…\u manual功能时,我会获得第二个图例(见下文) require(ggplot2) 要求(2) 需要(plyr) ##参数 d如果我同时使用缩放*\u手动功能,我会得到一个带有以下表达式的图例: ggplot(mdf, aes(x=d, y=value, shape=meth, linetype=meth)) + geom_line() + geom_point() +

如何将表达式(plotmath)放入以下绘图的图例键标签中

我知道其中的内容和链接,但每当我使用
scale\u…\u manual
功能时,我会获得第二个图例(见下文)

require(ggplot2)
要求(2)
需要(plyr)
##参数
d如果我同时使用
缩放*\u手动
功能,我会得到一个带有以下表达式的图例:

ggplot(mdf, aes(x=d, y=value, shape=meth, linetype=meth)) + geom_line() +
    geom_point() + facet_grid(fam. ~ tau., scales="free_y", labeller=label_parsed) +
    ## scale_linetype_manual(values=1:4, breaks=meth, labels=meth.labs) + # problem: adds another legend
    scale_x_continuous(trans="log10", breaks=d, labels=d) +
    scale_y_continuous(trans="log10") + 
    scale_linetype_manual(breaks = c('m1','m2','m3','m4'),values = 1:4,labels = meth.labs) +
    scale_shape_manual(breaks = c('m1','m2','m3','m4'),values = 1:4,labels = meth.labs)

谢谢,乔兰,看起来很棒!我将把它放在我的原始示例中,看看它是否仍然有效:-)
ggplot(mdf, aes(x=d, y=value, shape=meth, linetype=meth)) + geom_line() +
    geom_point() + facet_grid(fam. ~ tau., scales="free_y", labeller=label_parsed) +
    ## scale_linetype_manual(values=1:4, breaks=meth, labels=meth.labs) + # problem: adds another legend
    scale_x_continuous(trans="log10", breaks=d, labels=d) +
    scale_y_continuous(trans="log10") + 
    scale_linetype_manual(breaks = c('m1','m2','m3','m4'),values = 1:4,labels = meth.labs) +
    scale_shape_manual(breaks = c('m1','m2','m3','m4'),values = 1:4,labels = meth.labs)