r - Forestplot() 中绘图区域的宽度是否存在参数
问题描述
是否有调整 Forestplot() 中绘图区域的宽高比的参数?我想将 x 轴设置为 y 轴高度的 2/3。
谢谢!
# Package
library(forestplot)
# Data
test_data <- data.frame(coef=c(1.59, 1.24),
low=c(1.4, 0.78),
high=c(1.8, 1.55),
varname=c("aa","bb"),
varexplan=c("A very long description A very long description","A very long description A very long description"))
test_data$varexplan <- as.character(test_data$varexplan)
test_data$varname <- as.character(test_data$varname)
# Prepare text
tabletext <- cbind(c(test_data$varname),
c(test_data$explan))
# Plot
forestplot(tabletext,
test_data$coef,
test_data$low,
test_data$high)
解决方案
如果它对某人有帮助:包forestplot
确实提供了一个选项来设置图形宽度,恰当地命名为graphwidth
,它需要一个unit
参数:例如,
forestplot(tabletext,
test_data$coef,
test_data$low,
test_data$high,
graphwidth = unit(5, "cm"))
如果您想让绘图区域比例独立于导出功能,这可能是一个稍微优雅的选择。
推荐阅读
- javascript - Paho MQTT JS 客户端已连接错误?
- python - 使用 Pandas 计算频率和计数记录
- asp.net-core - 在 Asp.Net Core 下为 RequestId 日志配置 JsNLog 和 NLog
- cmake - 如何在 Windows 的 eigen3 中启用 pkg-config 支持?
- c++ - 在为类实现移动赋值运算符时真的需要自赋值检查吗?
- angular - 在 ionic 3 应用程序中使用 httpClient 模块的 Http 请求失败
- python - 使用 python 3 以二进制形式编写带有字符串的文件
- semantic-ui - 语义 UI 可排序表排除列
- javascript - Vuex提交:JSON循环结构错误
- c++ - C ++如何以十进制(而不是十六进制)显示数组元素内存地址?