减小地块面积

减小地块面积

你好,我在 R 中的 knitr 中有这个图,我想将其传输到我的 Latex PDF 文件中,但是它太大了,占据了 3/4 页的空间:

compPlot ( mdata$GDP, fitted( cesNewton), xlab = "Real Values",
ylab = "Fitted Values", col="red", main="Newton Method",  
cex.main=1, cex.lab=0.75, cex.axis=0.75)

我怎样才能使它变小并且使其位于页面中间?

\documentclass{article}

\begin{document}


<<>>=

library(micEconCES)

library(readxl)

DATA_FOR_2 <- read_excel("~/Documents/DATA FOR  2.xlsx", 
col_types = c("text", "text", "text", "text", "text", 
"numeric", "numeric","numeric", "numeric", "numeric", 
"numeric", "numeric", "numeric", "numeric", "numeric", 
"numeric", "numeric", "numeric", "numeric", "numeric", 
"numeric"))

mdata <- DATA_FOR_2[-c(46:62), ]

cesKmenta <- cesEst( yName = "GDP", xNames = c( "Capital", "Labour" ), 
data = mdata, method = "Kmenta", vrs = TRUE )

library( "miscTools" )

compPlot ( mdata$GDP, fitted( cesKmenta ), xlab = "Real Values",
ylab = "Fitted Values", col="red", main="Newton Method",  
cex.main=1, cex.lab=0.75, cex.axis=0.75)

@


\end{document}

抱歉,我不知道如何添加可重现的数据,我只是列出了我导入的 excel 表

答案1

您必须使用块选项来控制输出,并阅读此重要页面:https://yihui.name/knitr/options/

这是一个可以回答你的问题的 MRE

\documentclass{article}

\begin{document}
\SweaveOpts{concordance=TRUE}
\begin{figure}
\centering
<<minimal, fig=TRUE, height=12>>=
data(mtcars)
plot(mtcars[,1:2])
@
\end{figure}
\end{document}

相关内容