par函數的adj 參數- 控制文字的對齊方式
阿新 • • 發佈:2017-05-11
div 效果 lin .cn 表示 對齊方式 制圖 技術 cnblogs
adj 用來控制文字的對齊方式,取值範圍為0到1,控制圖片中x軸和y軸標簽,標題,以及通過text 添加的文字的對齊方式
0表示左對齊,代碼示例:
par(adj = 0)
plot(1:5, 1:5, type = "n", main = "title", xlab = "x", ylab = "y")
abline(h = 3, lty = 2)
abline(v = 3, lty = 2)
text(x = 3, y= 3, label = "text", cex = 2)
效果圖如下:
0.5為默認值,表示居中對齊,代碼示例:
par(adj = 0.5) plot(1:5, 1:5, type = "n", main = "title", xlab = "x", ylab = "y") abline(h = 3, lty = 2) abline(v = 3, lty = 2) text(x = 3, y= 3, label = "text", cex = 2)
效果圖如下:
1代表右對齊,代碼示例:
par(adj = 1) plot(1:5, 1:5, type = "n", main = "title", xlab = "x", ylab = "y") abline(h = 3, lty = 2) abline(v = 3, lty = 2) text(x = 3, y= 3, label = "text", cex = 2)
效果圖如下:
par函數的adj 參數- 控制文字的對齊方式