I would like to crop an image that is not inserted (which has been searched a lot), but an image that is generated in R code.
\documentclass{article}
\setlength{\parindent}{0pt}
\setcounter{secnumdepth}{0}
\usepackage[round,sort]{natbib}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfig}
\usepackage{verbatim}
\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
\usepackage{amssymb,amsbsy,amsmath}
\usepackage{epsfig}
\usepackage[left=3cm,top=3cm,bottom=3.5cm,right=3cm]{geometry}
\usepackage{fancyhdr}
\numberwithin{equation}{section}
\begin{document}
\SweaveOpts{concordance=TRUE}
<<label=plotName, include=FALSE>>=
someFunctionInR(someParameter)
@
\setkeys{Gin}{width=4in, height=4in}
\begin{figure}
\begin{center}
<<label=plotName,fig=TRUE,echo=FALSE>>=
<<plotName>>
@
\end{center}
\caption{Some caption.}
\label{fig:plotName}
\end{figure}
I tried to insert a statement as follows:
\includegraphics[clip=true,trim=0cm 1cm 0cm 1cm]
I did this in several locations, but for instance, immediately in the line after \begin{center}, I get an error ("Undefined control sequence").
Any suggestions would be greatly appreciated!