[Tikzdevice-bugs] ggplot-tikz examples
Charlie Sharpsteen
chuck at sharpsteen.net
Fri Jul 29 03:58:03 CEST 2011
On Thursday, July 28, 2011 6:21:31 PM UTC-7, Felipe Carrillo wrote:
>
> I was under the impression that I could create a report with graphics, text
> and tables
> directly from the R console using the tikz() function.
>
> I guess what I can't understand yet is what \usepackage{tikz}
> does by including it in the preamble.
> So the tikz() function used from the R console is mainly to make
> the graphics and no text or tables?
>
> Sorry for the many questions..I am almost getting it:)
>
The tikz() function invokes an R graphics device and R graphics devices are
absolutely focused on drawing things---points, lines, circles, etc. The idea
is to display the same content that the png(), pdf(), or windows() devices
display but in a much more LaTeX-friendly format. If you wanted to overlay
a table on top of your scatterplot, you will need to find an R package that
has a function for doing so.
However, I suspect that you probably don't want to wrap your paragraphs and
tabulated data up into a "graphic". The usual way of presenting these items
in a report is to have the graphics in figure environments, the tables in
a separate table environments and the paragraphs of text flowing around
these elements. For example:
\begin{document}
Some paragraphs of text describing the experiment.
\begin{figure}
<<figure_chunk>>=
# A plot rendered using tikz()
@
\label{}
\caption{}
\end{figure}
More text...
\begin{table}
<<data_display_chunk>>=
# Tabulated data, perhaps produced using something like the xtable
package
@
\label{}
\caption{}
\end{table}
On with the report...
\end{document}
Keeping your figures and tables in separate environments makes it easier
to cross-reference and the LaTeX table environment probably produces better
looking tables than anything an R package could assemble out of points lines
and circles on a graphics canvas.
-Charlie
More information about the Tikzdevice-bugs
mailing list