Defining control parameters for charts globally in knitr

To control the size of the graph in knitr

I use the following code

\begin{figure}[H]
   \centering
<< label = Plot1, fig.width=5, fig.height=5, out.width=.7\linewidth, fig.keep = all>>=
...
@
    \caption{Plot}
    \label{fig:figPlot1}
\end{figure}

      

I wonder how to define these control parameters for charts globally instead of defining each chart. Thanks for your help and time.

+3


source to share


1 answer


What about

\SweaveOpts{fig.width=5, fig.height=5, out.width=".7\\linewidth", fig.keep = "all"}

      



? I changed them to work with knitr version 0.3, which requires the parameter values ​​to be in valid R syntax ...

+1


source







All Articles