2011-08-19 47 views
14

this page我已经认识到的是:如何更改主标题的字体在图()

font.main=4 

会给我一个斜粗体标题为我的身影。然而,我不想要的只是一种普通的旧式无衬线字体。更一般地说,我一直在寻找一个什么值做什么但没有找到的表。有没有,如果有的话,我可以在哪里看到它?

回答

13

?par

‘font’ An integer which specifies which font to use for text. If 
    possible, device drivers arrange so that 1 corresponds to 
    plain text (the default), 2 to bold face, 3 to italic and 4 
    to bold italic. Also, font 5 is expected to be the symbol 
    font, in Adobe symbol encoding. On some devices font 
    families can be selected by ‘family’ to choose different sets 
    of 5 fonts. 

所有这些都适用于font.main。比较:

> layout(1:2) 
> plot(1:10, font.main = 1, main = "Foo") ## plain font 
> plot(1:10, main = "Foo")    ## default bold font 
> layout(1) 

这给:

enter image description here

+1

它的价值在'extrafont'包看太 –

9

控制字体有两个相关参数。 fontfamily。您可能需要更改family而不是font

Quick-R on graphical parameters

字体:整数,指定要使用的字体的文本。 1 =普通,2 =粗体, 3 =斜体,4 =粗体斜体,5 =符号
...
家族:字体族绘制文本。标准值是“serif”,“sans”,“mono”,“symbol”。映射依赖于设备。

此外:

在Windows中,单被映射为 “TT宋体”,衬线被映射为 “TT 宋体”,SANS被映射为 “TT宋体”,单是映射到“TT Courier New”,符号映射到“TT符号”(TT = True Type)。你 可以添加你自己的映射。

# Type family examples - creating new mappings 
plot(1:10,1:10,type="n") 
windowsFonts(
    A=windowsFont("Arial Black"), 
    B=windowsFont("Bookman Old Style"), 
    C=windowsFont("Comic Sans MS"), 
    D=windowsFont("Symbol") 
) 
text(3,3,"Hello World Default") 
text(4,4,family="A","Hello World from Arial Black") 
text(5,5,family="B","Hello World from Bookman Old Style") 
text(6,6,family="C","Hello World from Comic Sans MS") 
text(7,7,family="D", "Hello World from Symbol") 

?par看到。

附注:Quick R,特别是Graphics上的东西,是很多R相关信息的好资源。

相关问题