在R'中修改X轴;s Sciplot包包括斜体和非斜体文本

在R'中修改X轴;s Sciplot包包括斜体和非斜体文本,r,R,我已经读了好几个小时了,但我还是不明白这一点。我非常喜欢ScicPlot,但我对R的基本图形功能不够熟悉,无法理解如何从ScicPlot修改绘图。我想对这个情节讲一件事:把A.sayanus和L.Cyanellus改成斜体 绘图:[ 我的代码: lineplot.CI( Species2, #categorical factor for the x-axis AvgMass, Lethal, data=d,

我已经读了好几个小时了,但我还是不明白这一点。我非常喜欢ScicPlot,但我对R的基本图形功能不够熟悉,无法理解如何从ScicPlot修改绘图。我想对这个情节讲一件事:把A.sayanus和L.Cyanellus改成斜体

绘图:[

我的代码:

lineplot.CI(
          Species2,  #categorical factor for the x-axis
          AvgMass,
          Lethal,
          data=d,
          ylab="Metamorph mass (g)",
          xlab=NA)
此外,如果有人知道如何将trace.label与图例内容一起向左移动,那也太好了。例如:

lineplot.CI(
     Species2,  #categorical factor for the x-axis
     AvgMass,
     Lethal,
     data=d,
     trace.label = "Treatment",
     x.leg=1,
     ylab="Metamorph mass (g)",
     xlab=NA)
。 如您所见,当我输入x.leg=1时,图例内容会移动,但trace.label与之不匹配…

好的,所以我算出了(至少是第一部分)。您需要使用
xaxt
关闭x轴标签,然后创建标签的新字符向量。然后使用
axis()
将这些标签粘贴回图形上。我使用了
at=c(1,2,3)
,因为原始标签位于该位置,我使用
axis(side=1)

plot1
plot1<-lineplot.CI(
      Species2,  #categorical factor for the x-axis
      AvgMass,
      Lethal,
      data=d,
      ylab="Metamorph mass (g)",
      xlab=NA,
      xaxt="n",
      x.leg=1)
   labels <- c(expression("Control", italic("A. sayanus"), italic("L. cyanellus")))
   axis(side=1,at=c(1,2,3),labels=labels)