• R语言
  • 请问绘图时标签无法显示上下标应该如何解决?

读取后的数据框里列名称改成了有下标的,绘图时不显示!

上标

library("ggplot2") 
  
# Create a DataFrame For Plotting 
DF <- data.frame(X = rnorm(10),                         
                 Y = rnorm(10)) 
  
# Create ggplot2 ScatterPlot with SuperScripted  
# value of Label of Axis. 
ggplot(DF,aes(X, Y))+ 
  geom_point(size = 8, fill = "green",  
             color = "black", shape = 21)+ 
  xlab(bquote(X-Axis^superscript))+ 
  ylab(bquote(Y-Axis^superscript))

下标

library("ggplot2") 
  
# Create a DataFrame For Plotting 
DF <- data.frame(X = rnorm(10),                         
                 Y = rnorm(10)) 
  
# Create ggplot2 ScatterPlot with SubScripted  
# value of Label of Axis. 
ggplot(DF,aes(X, Y))+ 
  geom_point(size = 8, fill = "green", 
             color = "black", shape = 21)+ 
  xlab(bquote(X-Axis[subscript]))+ 
  ylab(bquote(Y-Axis[subscript]))

https://www.geeksforgeeks.org/superscript-and-subscript-axis-labels-in-ggplot2-in-r/

    tctcab 谢谢回复,不过我的问题是列名称里的下标变成图的坐标标签后变成了方框,绘制的是相关性热图

      wudigb

      有代码吗,看看用的啥包,另外运行sessionInfo()生成的环境信息也贴一下看看