我使用以下代码绘制散点图.如何增加字体大小和改变x轴和y轴标签的颜色?
data=read.csv("data.csv")
plot(data$column1,data$column2,xlab="x axis", ylab="y axis", pch=19)
Run Code Online (Sandbox Code Playgroud)
mne*_*nel 43
查看?par各种图形参数.
一般cex控制尺寸,col控制颜色.如果你想控制标签的颜色,par是col.lab,轴注释col.axis的颜色,main文本的颜色col.main等.一旦你知道从哪里开始,名字是非常直观的.
例如
x <- 1:10
y <- 1:10
plot(x , y,xlab="x axis", ylab="y axis", pch=19, col.axis = 'blue', col.lab = 'red', cex.axis = 1.5, cex.lab = 2)
Run Code Online (Sandbox Code Playgroud)

如果您需要更改周围框和轴线的颜色/样式,请查看?axis或?box,您会发现在调用box和轴中将使用相同的参数名称.
无论你想要什么,你都有很多控制权.
例如
plot(x , y,xlab="x axis", ylab="y axis", pch=19, cex.lab = 2, axes = F,col.lab = 'red')
box(col = 'lightblue')
axis(1, col = 'blue', col.axis = 'purple', col.ticks = 'darkred', cex.axis = 1.5, font = 2, family = 'serif')
axis(2, col = 'maroon', col.axis = 'pink', col.ticks = 'limegreen', cex.axis = 0.9, font =3, family = 'mono')
Run Code Online (Sandbox Code Playgroud)

这是非常难看的,但显示了你可以控制的部分内容
42-*_*42- 34
要追踪正确的参数,首先需要先找到?plot.default,它指的是?par和?axis:
plot(1, 1 ,xlab="x axis", ylab="y axis", pch=19,
col.lab="red", cex.lab=1.5, # for the xlab and ylab
col="green") # for the points
Run Code Online (Sandbox Code Playgroud)