如何在R图中改变Xlab、Ylab以及xy轴颜色和字体大小的值

时间:2022-10-15 19:34:19

I'd like to change the color and font size of:

我想改变颜色和字体大小:

  1. Xlab,
  2. Xlab,
  3. Ylab,
  4. Ylab,
  5. values of X and Y-axis
  6. X和y轴的值
  7. Panel border (color)
  8. 面板边境(颜色)

in R plot Is there a way to do it?

在R图中有办法吗?

2 个解决方案

#1


11  

Here's code demonstrating some of the lower level plotting functions that provide the sort of fine-grained control that you're wanting. See the help pages of the several functions for even more options.

下面的代码演示了一些较低级的绘图功能,它们提供了您想要的那种细粒度控制。更多选项请参见几个函数的帮助页面。

plot(rnorm(99), bty="n", axes=FALSE, xlab="", ylab="")
box(col="dodgerblue")
axis(1, col="dodgerblue", col.ticks="green", col.axis="orange", cex.axis=2)
axis(2, col="dodgerblue", col.ticks="green", col.axis="orange", cex.axis=0.8)
mtext("Index", side=1, line=3, col="red", cex=2)
mtext("Value", side=2, line=3, col="purple", cex=0.8)

(The resulting plot is ugly enough that I'll let you run the code yourself, rather than reproduce it here!)

(结果的情节非常丑陋,我将让您自己运行代码,而不是在这里复制它!)

#2


4  

Check out the ?par help page, as well as the relevant Quick-R tutorials for an overview of the parameters you can change to embellish or annotate a base R plot.

查看?par帮助页面,以及相关的Quick-R教程,了解可以更改为修饰或注释基本R图的参数。

#1


11  

Here's code demonstrating some of the lower level plotting functions that provide the sort of fine-grained control that you're wanting. See the help pages of the several functions for even more options.

下面的代码演示了一些较低级的绘图功能,它们提供了您想要的那种细粒度控制。更多选项请参见几个函数的帮助页面。

plot(rnorm(99), bty="n", axes=FALSE, xlab="", ylab="")
box(col="dodgerblue")
axis(1, col="dodgerblue", col.ticks="green", col.axis="orange", cex.axis=2)
axis(2, col="dodgerblue", col.ticks="green", col.axis="orange", cex.axis=0.8)
mtext("Index", side=1, line=3, col="red", cex=2)
mtext("Value", side=2, line=3, col="purple", cex=0.8)

(The resulting plot is ugly enough that I'll let you run the code yourself, rather than reproduce it here!)

(结果的情节非常丑陋,我将让您自己运行代码,而不是在这里复制它!)

#2


4  

Check out the ?par help page, as well as the relevant Quick-R tutorials for an overview of the parameters you can change to embellish or annotate a base R plot.

查看?par帮助页面,以及相关的Quick-R教程,了解可以更改为修饰或注释基本R图的参数。