R 中的表达式
Expression in R
我想在 R 中绘图时为我的 ylab=
使用 expression
。如何使用 expression
使用 \mathcal{} 样式字体获取字符?我是 运行 Ubuntu,我不想使用 ggplot。
澄清一下:ylab
的一部分将包含数学字符,而另一部分则不会(并且将是一个公式)。这就是为什么我想使用 expression
我想要的是这个符号:
= \数学{E}
一个可能的解决方案是使用 tikz
,这有点棒,这里有一个比他们在函数 tikzDevide::tikz
:[=14= 的帮助下生成的例子漂亮得多的例子]
require(filehash)
require(tikzDevice)
tikz("sinhplot.tex", width = 8, height = 4,
standAlone = TRUE,
packages = c("\usepackage{tikz}",
"\usepackage[active,tightpage,psfixbb]{preview}",
"\PreviewEnvironment{pgfpicture}",
"\setlength\PreviewBorder{0pt}",
"\usepackage{amssymb}")
plot(sinh, col="steelblue", lwd=2, xlim=c(-3,3), xlab="$\mathcal E= [-3 , 3]$")
grid()
dev.off()
tools::texi2dvi(sinhplot,pdf=T)
system(paste(getOption('pdfviewer'),'sinhplot.pdf'))
结果看起来很不错!
另一种解决方案是放弃在图形标签中使用漂亮的字符...
我想在 R 中绘图时为我的 ylab=
使用 expression
。如何使用 expression
使用 \mathcal{} 样式字体获取字符?我是 运行 Ubuntu,我不想使用 ggplot。
澄清一下:ylab
的一部分将包含数学字符,而另一部分则不会(并且将是一个公式)。这就是为什么我想使用 expression
我想要的是这个符号:
一个可能的解决方案是使用 tikz
,这有点棒,这里有一个比他们在函数 tikzDevide::tikz
:[=14= 的帮助下生成的例子漂亮得多的例子]
require(filehash)
require(tikzDevice)
tikz("sinhplot.tex", width = 8, height = 4,
standAlone = TRUE,
packages = c("\usepackage{tikz}",
"\usepackage[active,tightpage,psfixbb]{preview}",
"\PreviewEnvironment{pgfpicture}",
"\setlength\PreviewBorder{0pt}",
"\usepackage{amssymb}")
plot(sinh, col="steelblue", lwd=2, xlim=c(-3,3), xlab="$\mathcal E= [-3 , 3]$")
grid()
dev.off()
tools::texi2dvi(sinhplot,pdf=T)
system(paste(getOption('pdfviewer'),'sinhplot.pdf'))
结果看起来很不错!
另一种解决方案是放弃在图形标签中使用漂亮的字符...