是否有调整绘图区宽度与高度比的论点?我想把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)发布于 2018-10-16 11:46:28
如果它帮助了某人: package forestplot确实提供了一个设置图形宽度的选项,该选项名为graphwidth,这需要一个unit参数:例如,
forestplot(tabletext,
test_data$coef,
test_data$low,
test_data$high,
graphwidth = unit(5, "cm"))如果您想要使绘图区域比例独立于导出函数,这可能是一个稍微优雅一些的选项。
发布于 2018-07-06 16:02:22
您可以在导出绘图时设置所需的比例,例如使用png()。绘图将保存到您的工作目录中。
h <- 1080
png(height = h, width=2/3*h, res=300)
forestplot(tabletext,
test_data$coef,
test_data$low,
test_data$high)
dev.off()产量

https://stackoverflow.com/questions/51213259
复制相似问题