0

Hi there so I have this plot in knitr in R, which i want to transfer to my Latex PDF file, but it's just way too big it fills up like 3/4 of a page:

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)

how can I make it smaller and also center it in the middle of the page?

\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}

I'm sorry I don't know how to add reproducible data, I just listed the excel sheet, which I imported

1

You have to use chunk option to control the output, and read this essential page: https://yihui.name/knitr/options/

This is a MRE that answer your question

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.