[R] tikzDevice and Sweave

Naresh Gurbuxani naresh_gurbuxani at hotmail.com
Sun Jan 17 21:25:47 CET 2016


I want to use tikz() function in tikzDevice package so that it generates a pdf file to be included in the bigger tex file.  Below code works, but directly inserts tikz commands in the output tex file.  
This works:
<<name = tikzFig, echo = FALSE, results = tex>>= 
This does not work:
<<name = tikzFig, echo = FALSE, fig = TRUE>>=
Full code is given below:
\documentclass{article}\usepackage{tikz}
Figure~\ref{tikzExampleFig} is and an example of \texttt{tikzDevice} package. 
\begin{figure}\begin{center}
<<name = tikzFig, echo = FALSE, results = tex>>=
library(tikzDevice)tikz(console = TRUE)plot(sin, -pi, pi, main = "A stand alone TikZ plot", xlab = "x", ylab = "sin(x)")dummy <- dev.off()@
\caption{Example of tikz graph}\label{tikzExampleFig}\end{center}\end{figure}
\end{document}


 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list