R 用撇号和文本注释希腊字母

R annotate greek letter with apostrophe and text

我正在尝试在结合希腊字母与撇号和文本的 ggplot2 图中注释文本。直到现在我都无法实现这个问题。

目前,我可以编写以下标签,结合注释和 geom_text,代码如下:

ggplot(Lab_all_direct_shear)+
    geom_rect(aes(xmin = 0, xmax = 20, ymin = 0, ymax = 120), color = NA, fill="grey", alpha = 0.05)+
    geom_segment(linetype = 8,color="#666666",aes(x = 0, y = 0, xend = 55, yend = 88.649))+
    geom_point(size=3,shape=21,fill ="#F8766D",aes(x=constitutive_normal_stress_15_kPa,y=constant_volume_shear_strenght_15_kPa))+
    geom_point(size=3,shape=21,fill ="#00BA38",aes(x=constitutive_normal_stress_19_kPa,y=constant_volume_shear_strenght_19_kPa))+
    geom_point(size=3,shape=21,fill ="#619CFF",aes(x=constitutive_normal_stress_25_kPa,y=constant_volume_shear_strenght_25_kPa))+
    scale_x_continuous(limits = c(0,60),breaks=c(0,10,20,30,40,50,60),expand = c(0, 0)) +
    scale_y_continuous(limits = c(0,120), breaks=c(0,10,20,30,40,50,60,70,80,90,100,110,120),expand = c(0, 0)) +
    labs(x=expression(~sigma[n]~+~s~S[r]~(kPa)),y = "",title="") +
    annotate("text", x = 54, y = 70, label = "= 58.2°",size=4)+
    geom_text(x=50,y=70,label="phi",parse=TRUE)+
    theme_bw() +
    theme(plot.title = element_text(size=10, face="bold", hjust=0.5),
            axis.title = element_text(size=10),
            axis.title.x = element_text(angle=0, hjust=0.5),
            axis.title.y = element_blank(),
            axis.text = element_text(size=10,color="black"),
            axis.text.x = element_text(size=10),
            axis.text.y = element_blank(),
            panel.grid.major = element_line(color= NA),
            panel.grid.minor = element_line(color= NA),
            plot.margin=unit(c(0.1,0.2,0.1,0.4), "cm"), #The four numbers are c(top,right,bottom,left)
            legend.text = element_text(size=10),
            legend.title = element_text(size=10),
            legend.position = "none")

R ggplot2 包中的结果:

greek letter annotate without apostrophe

我尝试了不同的组合(将其声明为表达式、粘贴等,但我无法解决)。

我想在 excel 中获得这样的图,带有以下注释(带上标撇号的 phi 与文本结合):

excel plot with desired annotation

任何帮助将不胜感激!

提前致谢, 劳尔

这是示例图片:

    data <- data.frame(x = 1:10, y  = 1:10)
    ggplot(data, aes(x, y))+
      geom_point(color = "blue")+
      geom_line(linetype = "dashed", color = "blue")+
      annotate("text", x = 6, y = 7, label  = "phi*' \''==58^o",
               parse = TRUE)+
      theme_bw()