R 图中的字体 [英] Fonts in R plots

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

问题描述

哪些图形设备可以让我对图表中的文本使用系统字体?基本图形系统只有少量关于 par(family=...) 选项的文档.

What graphics devices let me use system fonts for text within charts? The base graphics system only has a small amount of documentation around the par(family=...) options.

理想情况下,我希望能够使用我可以通过 Linux 上的 xfontsel 之类的工具或其他平台上的等效实用程序浏览的任何字体.

Ideally I'd like to be able to use any font I can browse through a tool like xfontsel on Linux or the equivalent utilities on other platforms.

我目前的解决方案是绘制为 PDF,然后使用第三方程序替换 PDF 中的字体.这并不理想.

My current solution is to plot out as PDF and then use a 3rd party program to replace the fonts from within the PDF. This is not ideal.

推荐答案

pdf() 命令可以使用字体列表,如下所示:

A list of fonts is available to the pdf() command, like this:

> names(pdfFonts())
 [1] "serif"                "sans"                 "mono"                
 [4] "AvantGarde"           "Bookman"              "Courier"             
 [7] "Helvetica"            "Helvetica-Narrow"     "NewCenturySchoolbook"
[10] "Palatino"             "Times"                "URWGothic"           
... etc ...

在创建 PDF 时使用,例如:

To use when creating a PDF, for example:

> pdf(file="plot.pdf",family="Palatino", pointsize=16, width=16,height=10)

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

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