将LaTeX放入R图 [英] Getting LaTeX into R Plots

查看:127
本文介绍了将LaTeX放入R图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用base/latticeggplot2的组合将LaTeX排版添加到R中的图元素(例如标题,轴标签,注释等).

I would like to add LaTeX typesetting to elements of plots in R (e.g: the title, axis labels, annotations, etc.) using either the combination of base/lattice or with ggplot2.

问题:

  • 是否有一种方法可以使用这些软件包将LaTeX放入绘图中,如果可以,如何完成?
  • 否则,是否需要其他软件包来完成此任务.
  • Is there a way to get LaTeX into plots using these packages, and if so, how is it done?
  • If not, are there additional packages needed to accomplish this.

例如,在Python matplotlib中,通过text.usetex包编译LaTeX,如下所述: http://www.scipy.org/Cookbook/Matplotlib/UsingTex

For example, in Python matplotlib compiles LaTeX via the text.usetex packages as discussed here: http://www.scipy.org/Cookbook/Matplotlib/UsingTex

是否有类似的过程可以在R中生成这些图?

Is there a similar process by which such plots can be generated in R?

推荐答案

以下是使用ggplot2的示例:

q <- qplot(cty, hwy, data = mpg, colour = displ)
q + xlab(expression(beta +frac(miles, gallon)))

这篇关于将LaTeX放入R图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆