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

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

问题描述

什么图形设备让我使用图表内的文字系统字体?基本的图形系统只有 par(family = ...)选项的少量文档。



理想情况下,我希望能够使用任何字体浏览Linux上的 xfontsel 或其他平台上的等效工具。



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

解决方案

我今天早上刚刚在这个问题上工作。我发现你可以得到 pdf()命令可用的字体列表,如下所示:

 >名称(pdfFonts())
[1]serifsansmono
[4]AvantGardeBookmanCourier
HelveticaHelvetica - NewCenturySchoolbook
[10]PalatinoTimesURWGothic
...等等...

然后我就这样做了我的生意:

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


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.

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.

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.

解决方案

I just worked on this issue this morning. I found that you can get a list of fonts 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 ...

So I then went about my business with this:

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

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

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