[Tikzdevice-bugs] tikz: remove "white frame" around plot?

412 views
Skip to first unread message

Matthieu Stigler

unread,
Sep 6, 2011, 12:13:14 PM9/6/11
to tikzdev...@r-forge.wu-wien.ac.at
Hi

I am trying to get a plot with the same background color than the
background color of the LaTeX page. However, it seems that tikzDevice is
introducing by default a command:

\definecolor[named]{fillColor}{rgb}{1.00,1.00,1.00}
\fill[color=fillColor,] (0,0) rectangle (238.49,238.49);

I searched around to see how to remove this line... did not find... is
there any way to remove it? The problem is that using ggplot2, I try to
control this frame color from within ggplot2:
theme_update(
plot.background = theme_rect(fill = part1_main70bis,
colour=part1_main70bis)
)

but this is overriden by tikz :-(

Any idea? Thanks!!

Matthieu
_______________________________________________
Tikzdevice-bugs mailing list
Tikzdev...@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs

Charlie Sharpsteen

unread,
Sep 6, 2011, 7:40:15 PM9/6/11
to Matthieu Stigler, tikzdev...@r-forge.wu-wien.ac.at
On Tue, Sep 6, 2011 at 9:13 AM, Matthieu Stigler <matthieu...@gmail.com
> wrote:

> Hi
>
> I am trying to get a plot with the same background color than the
> background color of the LaTeX page. However, it seems that tikzDevice is
> introducing by default a command:
>

> \definecolor[named]{fillColor}**{rgb}{1.00,1.00,1.00}


> \fill[color=fillColor,] (0,0) rectangle (238.49,238.49);
>
> I searched around to see how to remove this line... did not find... is
> there any way to remove it? The problem is that using ggplot2, I try to
> control this frame color from within ggplot2:
> theme_update(
> plot.background = theme_rect(fill = part1_main70bis,
> colour=part1_main70bis)
> )
>
> but this is overriden by tikz :-(
>
> Any idea? Thanks!!
>
> Matthieu
>

Which version of R and which version of tikzDevice are you using?

-Charlie

Matthieu Stigler

unread,
Sep 7, 2011, 3:50:54 AM9/7/11
to tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen
Hi

I am using R 2.13 and tikzDevice 0.6.1 (see below for full sesionInfo).

Here would be full reproducible code:

library(ggplot2)
library(tikzDevice)

part1_main70bis<-rgb(0.05,0.4,0.5,maxColorValue=1)


theme_update(
plot.background = theme_rect(fill = part1_main70bis,
colour=part1_main70bis)
)

options(tikzLatexPackages=c("\\usepackage{tikz}","\\usepackage{color}\n\\definecolor{part1}{rgb}{0.05,0.4,0.5}\n\\pagecolor{part1}\n"))
tikz(standAlone=TRUE)
qplot(1,1)
dev.off()

It is this white border I would like to remove, do you see it? The
guilty line is this one (line 13):
% \fill[color=fillColor,] (0,0) rectangle (505.89,505.89);

Thanks!

Matthieu

> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=en_US.utf8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=fr_FR.UTF-8
[9] LC_ADDRESS=fr_FR.UTF-8 LC_TELEPHONE=fr_FR.UTF-8
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=fr_FR.UTF-8

attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base

other attached packages:
[1] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4 plyr_1.6
[5] tikzDevice_0.6.1 filehash_2.2 rkward_0.5.6

loaded via a namespace (and not attached):
[1] tools_2.13.1

Le 07/09/2011 01:40, Charlie Sharpsteen a écrit :
> On Tue, Sep 6, 2011 at 9:13 AM, Matthieu Stigler
> <matthieu...@gmail.com <mailto:matthieu...@gmail.com>> wrote:
>
> Hi
>
> I am trying to get a plot with the same background color than the
> background color of the LaTeX page. However, it seems that
> tikzDevice is introducing by default a command:
>

> \definecolor[named]{fillColor}{rgb}{1.00,1.00,1.00}

Matthieu Stigler

unread,
Sep 9, 2011, 6:00:55 AM9/9/11
to tikzd...@googlegroups.com, tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen
Hi

Just wanted to come back on this question: do you see also the white
frame with the code above? Do you know how one could get rid of it?

Thanks!

Matthieu

Cameron Bracken

unread,
Sep 9, 2011, 4:43:48 PM9/9/11
to Matthieu Stigler, tikzd...@googlegroups.com, tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen
Hi Matthieu-

So I fixed this: https://github.com/Sharpie/RTikZDevice/issues/41

The problem was we were using a separate border color for the outline of the background rectangle but the user cant set that in R, so it was always white.

You can install from the github source for now or manually change the line you referenced to:

\fill[color=fillColor,fill opacity=0.00,] (0,0) rectangle (505.89,505.89);

which is what it will be from now on.

-Cameron

Matthieu Stigler

unread,
Sep 13, 2011, 11:45:09 AM9/13/11
to Cameron Bracken, tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen, tikzd...@googlegroups.com
Dear Cameron

Thanks for this quick fix and for making this wonderful tikzDevice
package, that we appreciate so much!

Matthieu

Matthieu Stigler

unread,
Sep 15, 2011, 4:20:43 AM9/15/11
to Cameron Bracken, tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen, tikzd...@googlegroups.com
Hi

I am not actually sure to which branch the patch was appélied, and how
to install that newest version?

I did download what I believe to be the master version:

|git clone git://github.com/Sharpie/RTikZDevice.git

|

|Is it the right one?|
||
Then just made R CMD INSTALL, compilation worked but when opening
tikzDevice, it doesn't not check for the drivers so says:
tikz(standAlone=TRUE)
Erreur dans switch(engine, pdftex = { :
EXPR doit être un vecteur de longueur 1

Then I tried
$cd Sharpie-RTikZDevice-3ffa3c6/
$sudo make install

and get:

basename: opérande manquante

Pour en savoir davantage, faites: « basename --help ».

cd ..;\

"/usr/bin/R" --vanilla --slave -e "library(roxygen); roxygenize('', '.build', use.Rd2=TRUE, overwrite=TRUE, unlink.target=TRUE)"

Le chargement a nécessité le package : digest

Loading required package: tools

Writing namespace directives to .build/NAMESPACE

Erreur dans setwd(dir) : impossible de changer de répertoire de travail

Calls: roxygenize -> <Anonymous> -> setwd

Exécution arrêtée

make: *** [docs] Erreur 1

Could you kindly let me know what I am doing wrong, how to solve this?

Thanks!!

Matthieu

Le 09/09/2011 22:43, Cameron Bracken a écrit :

Cameron Bracken

unread,
Sep 15, 2011, 1:34:33 PM9/15/11
to Matthieu Stigler, tikzd...@googlegroups.com, tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen
It looks like the makefile is not able to get the working directory correctly. The makefile is supposed to create a build directory one directory up called `<basename>.build` and produce all the documentation there. But from the line

Writing namespace directives to .build/NAMESPACE

that is obviously not working. This must be a difference in the make on your system or something like that. You may need to modify line 3 in the Makefile:

PKGSRC := $(shell basename $(PWD))

I'm not very good at this stuff, but im pretty sure that is what is going on. Charlie may know better how to fix this.

In the short term I have made a source package build (attached). You can run R CMD INSTALL on it directly.

-Cameron

On Sep 15, 2011, at 2:20 AM, Matthieu Stigler wrote:

> git clone git://github.com/Sharpie/RTikZDevice.git

tikzDevice_0.6.2.tar.gz

Charlie Sharpsteen

unread,
Sep 15, 2011, 2:28:27 PM9/15/11
to tikzd...@googlegroups.com, Matthieu Stigler, tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen
On Thursday, September 15, 2011 10:34:33 AM UTC-7, Cameron B. wrote:
>
> It looks like the makefile is not able to get the working directory
> correctly. The makefile is supposed to create a build directory one
> directory up called `<basename>.build` and produce all the documentation
> there. But from the line
>
> Writing namespace directives to .build/NAMESPACE
>
> that is obviously not working. This must be a difference in the make on
> your system or something like that. You may need to modify line 3 in the
> Makefile:
>
> PKGSRC := $(shell basename $(PWD))
>
> I'm not very good at this stuff, but im pretty sure that is what is going
> on. Charlie may know better how to fix this.
>
Yeah, the Makefile requires GNU Make. Perhaps I should make this explicit by
renaming it to GNUmakefile as BSD make will ignore that name. I will also
try to make a push to RForge this afternoon so that a version of tikzDevice
with these fixes can be obtained via `install.packages`.

-Charlie

Matthieu Stigler

unread,
Sep 16, 2011, 9:44:46 AM9/16/11
to Cameron Bracken, tikzdev...@r-forge.wu-wien.ac.at, Charlie Sharpsteen, tikzd...@googlegroups.com
great, the compiled package worked, thanks so much!

But for the make, this is strange: I am on a standard Ubuntu 10.10, with
I guess the GNU make!

Thanks!

_______________________________________________

Reply all
Reply to author
Forward
0 new messages