将LaTex中的符号转换为R中的ggplot2

Ale*_*lex 3 plot latex r ggplot2

我试图让下面的表达式到我的刻度标记ggplot2:x \to y这里\to是通常的乳胶箭头符号.这样做的正确方法是什么?expression(x%to%y)似乎不起作用.

mne*_*nel 9

使用

%->%

例如

plot(1, type='n')
text(1,1, expression(x %->%y))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

各种箭头描述于 ?plotmath

x %<->% y      # x double-arrow y
x %->% y       # x right-arrow y
x %<-% y       # x left-arrow y
x %up% y       # x up-arrow y
x %down% y     # x down-arrow y
x %<=>% y      # x is equivalent to y
x %=>% y       # x implies y
x %<=% y       # y implies x
x %dblup% y    # x double-up-arrow y
x %dbldown% y  #     x double-down-arrow y
Run Code Online (Sandbox Code Playgroud)

如果你想要真正的 LaTex,那么你可以尝试让tikzDevice适用于你的版本R