如何更改绘图的第二个主标题行中的字体大小

时间:2021-08-14 23:39:23

In addition to this question (How to split the Main title of a plot in 2 or more lines?) I tried to give the second main title line another font size. cex.main=1 only varies the entire main title.

除了这个问题(如何在2行或更多行中分割绘图的主标题?)我试图给第二个主标题行另一个字体大小。 cex.main = 1只会改变整个主标题。

So I haven’t found anything how it could work…

所以我没有找到任何可行的方法......

Has anyone some hints?

有人提示吗?

Many thanks in advance!

提前谢谢了!

My code:

我的代码:

    plot(1, main=paste("X:",1," ","Y:", 2," ","\nZ:",3)) # the “Z: 3” should get a smaller font size

1 个解决方案

#1


1  

Alternative to adding second main title and increase font size would be to use title() with plot(). With title() you could also add and manipulate position of "second title" and also font type.

添加第二个主标题和增加字体大小的替代方法是使用title()和plot()。使用title(),您还可以添加和操作“第二个标题”的位置以及字体类型。

So the code looks like this:

所以代码看起来像这样:

    plot(1, main = paste("X:",1," ","Y:", 2," ")) 
   # In order to change font size use cex.main and in order to manipulate 
   # the position of second title use line()
  title(main = ("Z: 3"),  line = 0.5, cex.main = 0.8)

And the output (font of Z: 3 is smaller) 如何更改绘图的第二个主标题行中的字体大小

并且输出(Z:3的字体更小)

#1


1  

Alternative to adding second main title and increase font size would be to use title() with plot(). With title() you could also add and manipulate position of "second title" and also font type.

添加第二个主标题和增加字体大小的替代方法是使用title()和plot()。使用title(),您还可以添加和操作“第二个标题”的位置以及字体类型。

So the code looks like this:

所以代码看起来像这样:

    plot(1, main = paste("X:",1," ","Y:", 2," ")) 
   # In order to change font size use cex.main and in order to manipulate 
   # the position of second title use line()
  title(main = ("Z: 3"),  line = 0.5, cex.main = 0.8)

And the output (font of Z: 3 is smaller) 如何更改绘图的第二个主标题行中的字体大小

并且输出(Z:3的字体更小)