[Tikzdevice-bugs] ggplot-tikz examples

Cameron Bracken cameron.bracken at gmail.com
Thu Jul 28 21:53:32 CEST 2011


Felipe-

On Jul 27, 2011, at 8:42 PM, Felipe Carrillo wrote:

> Hi:
> I am using my laptop from home and everything seems to work ok here. A couple of
> question if you don't mind:
> 1 - If I want to create say a 20 page report with graphics
> and tables do I use the tikz() function over and over to make the graphics and tables or just one
> time at the beginning of my script?
>  

The short answer to your first question is you would have to invoke the tikz() command for every graphic you want to create and then \input it into you document:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\input{Rplots.tex}
\caption{}
\end{figure}
\end{document}

But this sounds like a perfect use for pgfSweave. It will invoke tikz() for you and include the results in the correct way without you having to worry about the details (I assume you are already familiar with Sweave). There are a few examples to get you started here:

https://github.com/cameronbracken/pgfSweave/tree/master/inst/example

There are some other great benefits of using pgfSweave such as caching of computations and graphics. I suggest checking out the vignette once the package is installed:

vignette('pgfSweave')

> 2- How do I include other LaTex packages using for example \usepackage{geometry}
>  
> I will check the manual but I would appreciate it if you can point out to a tex file or a latex document
> created with tikzDevice.
>  

To answer your second question, you can add necessary packages with the tikzDevice options:

options(tikzLatexPackages = c(getOption('tikzLatexPackages'),'\\usepackage{geometry}\n'))

see ?tikDevice for more options. These packages are used when calculating the character metrics from LaTeX along with those in the tikzMetricPackages option. If you don't need the geometry package for that then you can just include it in the document header where the graphic is \input. 

-Cameron

>  
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
> http://www.fws.gov/redbluff/rbdd_jsmp.aspx
> 
> From: Charlie Sharpsteen <chuck at sharpsteen.net>
> To: tikzdevice at googlegroups.com
> Cc: Cameron Bracken <cameron.bracken at gmail.com>; tikzDevice Bugs <tikzdevice-bugs at r-forge.wu-wien.ac.at>; Felipe Carrillo <mazatlanmexico at yahoo.com>
> Sent: Wednesday, July 27, 2011 1:37 PM
> Subject: Re: [Tikzdevice-bugs] ggplot-tikz examples
> 
> On Wednesday, July 27, 2011 1:30:26 PM UTC-7, Felipe Carrillo wrote:
> I don't know if I have PGF or the preview package,,I think I only have MiKTex
> Where can I get the above-mentioned package and software?
> 
> The MiKTeX package manager can help you install LaTeX packages. To do so, execute the following in a command line shell (cmd.exe):
> 
>     mpm --install pgf
>     mpm --install preview 
> 
> 
> On Wednesday, July 27, 2011 1:26:59 PM UTC-7, Felipe Carrillo wrote:
> Hi Cameron, Charlie:
> I am guessing that this file isn't created as stated below because I am using a goverment computer
> right now and some of the drives are write protected. If you think this could be the cause of the error
> message, I will run this at home tonight and see what happens. Thanks for the awesome package.
>  
> Creating temporary TikZ metrics dictionary at:
>         C:\DOCUME~1\FCARRI~1\LOCALS~1\ Temp\Rtmpd7Mnxe/ tikzMetricsDictionary
> 
> That could be the problem. However, it looks like R is able to write the temporary files that are used to calculate metrics and the temporary metrics dictionary is also created in the same location.
> 
> -Charlie 
> 
> 



More information about the Tikzdevice-bugs mailing list