简体   繁体   English

ggvis中的特殊符号

[英]Special symbols in ggvis

I'm making a fairly typical plot of geochemistry profiles for which I need to use a subscript and a greek symbol in the x-axis 我正在绘制一个相当典型的地球化学剖面图,为此我需要在x轴上使用下标和希腊符号

It should read CH4 (umol) where the 4 is subscript and the u is the greek symbol mu 它应显示为CH4(umol),其中4是下标,而u是希腊符号mu

ggvis code: 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)") 

Side-note: I know that I can make the proper labels in ggplot2 but I can't put the x-axis on top in ggplot2 旁注:我知道我可以在ggplot2中制作适当的标签,但不能将x轴放在ggplot2的顶部

library(ggvis)

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

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

在此处输入图片说明

In case you need more special characters in the future, look them up here and look for "C/C++/Java source code". 如果将来需要更多特殊字符,请在此处查找并查找“ C / C ++ / Java源代码”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM