ggvis中的特殊符号

Special symbols in ggvis

我正在制作一个相当典型的地球化学剖面图,我需要在 x 轴上使用下标和希腊符号

它应该读作 CH4 (umol),其中 4 是下标,u 是希腊符号 mu

ggvis代码:

ch4 %>% ggvis(~ch4_umol, ~depth_cm, fill=~Core, stroke=~Core) %>% 
  layer_lines(fillOpacity=0) %>% scale_numeric('y', reverse=T) %>% 
  add_axis("y", title = "Depth (cm)") %>%
  add_axis('x', orient='top', title="CH[4] ("mu "mol)") 

旁注:我知道我可以在 ggplot2 中制作适当的标签,但我不能在 ggplot2 中将 x 轴放在顶部

library(ggvis)

title <- "CH\u2084 (\u03BC mol)"

mtcars %>%
  ggvis(~wt, ~mpg) %>%
  layer_points() %>% 
  add_axis('x', orient = 'top', title = title) 

如果您以后需要更多特殊字符,请查找它们 here 并查找 "C/C++/Java source code"。