[R] Plotting in LaTeX with ggplot2 in R and using tikzdevice
jdnewmil at dcn.davis.ca.us
Thu Aug 4 02:57:21 CEST 2016
I would think knitr package would be useful in this endeavor. And possibly RStudio....
If that doesn't do it, someone here may have a better hint, but solving this kind of question can require studying both the input (R code) and output (tikz/LaTeX code). While the R code belongs here, details of the rest get OT pretty quick.
Sent from my phone. Please excuse my brevity.
On August 3, 2016 2:20:17 PM PDT, Ecstasia Tisiphoni <ecstasia1 at gmail.com> wrote:
>not totally sure if this is a R or a LaTeX topic...
>I am a total newbie to R and LaTeX, and trying to write my masters
>thesis right now... I tried to get this answered via
> ...but I failed... :(
>I am creating plots in R via ggplot2, and converting them to TeX
>format via tikzDevice.
>Now many of my plots have a legend on the right, which differs in size
>(depending of course on the legend title and text).
>If I now convert my Rplot using tikz() it only scales the size for the
>whole image it creates.
>What I want is: the rectangular plot itself to always be the same size
>for all my plots (no matter how big/small the legend and the axis
>My Rscript with some test Data:
>#setting time zone
>tikz(file = "my_output_file.tex", standAlone=F,width = 6, height = 3)
>cars['dt'] = seq(Sys.Date(),Sys.Date()-980,-20)
>plot <- ggplot(cars,aes(y=speed,x=dist,color=as.integer(dt)))+
>If I change now the legend text to a slightly longer text, the output
>of course has a completely different plot-size.
>Is there a way to maintain the plot size?
>I hope somebody can help me, or lead me to the information I need...
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help