sách gpt4 ai đã đi

r - 调整基础 R 中的情节标题和副标题

In lại 作者:行者123 更新时间:2023-12-03 18:14:12 27 4
mua khóa gpt4 Nike

如何获得基础 R 绘图标题和副标题以模仿 ggplots?我希望所有内容都左对齐,没有粗体,副标题直接在标题下方。

我还想在所有东西之间留出更多空间。也许我的换行符 \N 'hack' 是实现此目的的最佳方法?

plot(mtcars)
title(main = "I want main title NOT bold and left aligned\n\n",
sub = "Sub title should be under the main title left aligned")

r_titles

1 Câu trả lời

根据 Cettt 的建议,如何使用 mtext như sau:

plot(mtcars, oma=c(2, 3, 5, 2))
mytitle = "I want main title NOT bold and left aligned"
mysubtitle = "Sub title should be under the main title left aligned"
mtext(side=3, line=3, at=-0.07, adj=0, cex=1, mytitle)
mtext(side=3, line=2, at=-0.07, adj=0, cex=0.7, mysubtitle)
adj=0 选项请求左对齐。 line= 选项定义每个标题的垂直位置,从绘图上边缘的边界向外计数。
Bạn có thể sử dụng at= 选项根据需要水平移动标题。

还要注意在 oma= 调用中使用 plot() 选项,以便有足够的空间将标题放置在对图上方。

这是情节:
nhập mô tả hình ảnh ở đây

关于r - 调整基础 R 中的情节标题和副标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55002046/

27 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com