Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-26 Thread Marius Hofert
Dear Paul, Many thanks, that solved it. Cheers, Marius Paul Murrell writes: > Hi > > On 25/09/2012 6:10 p.m., Marius Hofert wrote: >> Dear Paul, >> >> Thanks. Redrawing the points solves it for the minimal example, but >> what happens if you have plot(.., type="b") like below? > > You can use

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-25 Thread Paul Murrell
Hi On 25/09/2012 6:10 p.m., Marius Hofert wrote: Dear Paul, Thanks. Redrawing the points solves it for the minimal example, but what happens if you have plot(.., type="b") like below? You can use points(..., type="b") Paul Actually, originally I wanted to use just grid (without mixing it w

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Marius Hofert
Dear Paul, Thanks. Redrawing the points solves it for the minimal example, but what happens if you have plot(.., type="b") like below? Actually, originally I wanted to use just grid (without mixing it with base graphics), but I couldn't find an equivalent for plot(.., type="b"). Also, later on,

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Paul Murrell
Hi On 25/09/12 11:50, Marius Hofert wrote: Dear Paul, Thanks for helping. Is there a way to call grid() first? The problem seems to be that everything drawn before grid() is overplotted. No, but you can redraw the points ... require(grid) require(gridBase) pdf(file="Rplot.pdf", width=8, hei

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Marius Hofert
Dear Paul, Thanks for helping. Is there a way to call grid() first? The problem seems to be that everything drawn before grid() is overplotted. Cheers, Marius require(grid) require(gridBase) pdf(file="Rplot.pdf", width=8, height=8, onefile=FALSE) ## set up the grid layout plot.new() # star

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Paul Murrell
Hi On 24/09/12 18:06, Marius Hofert wrote: Dear Paul, Thank you for helping. This works great. I then tried to put in a grid (via grid()). Why does that fail? Because grid() is used to add lines to an existing plot; just put the grid() call AFTER the plot() call and it should work ok. Pa

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Jeff Newmiller
Same reason. grid() is part of base graphics, which are incompatible with grid graphics. Perhaps you want grid.grill(), which you could find out about in the grid graphics vignette mentioned earlier. --- Jeff Newmiller

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-23 Thread Marius Hofert
Dear Jeff, Thanks for helping. I thought that gridBase would take care of using simple 'graphics' and grid plots (?) I tried grid.grill, but it's not so trivial to set it up such that the grid is drawn at the axis ticks. Cheers, Marius Jeff Newmiller writes: > Same reason. > > grid() is pa

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-23 Thread Marius Hofert
Dear Paul, Thank you for helping. This works great. I then tried to put in a grid (via grid()). Why does that fail? Cheers, Marius require(grid) require(gridBase) pdf(file="Rplot.pdf", width=8, height=8, onefile=FALSE) ## set up the grid layout plot.new() # start (empty) new page with 'gr

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-23 Thread Paul Murrell
Hi On 24/09/12 09:36, Marius Hofert wrote: Hi, Why does the upper left panel (in the plot below) not have a gray background? That is a symptom of the conflict that occurs when the 'graphics' package and the 'grid' package both try to initialise a new page. A good rule of thumb is to start a

[R] Background color in a grid plot seems to interfere with plot()

2012-09-23 Thread Marius Hofert
Hi, Why does the upper left panel (in the plot below) not have a gray background? Cheers, Marius require(grid) require(gridBase) pdf(file="Rplot.pdf", width=8, height=8, onefile=FALSE) ## set up the grid layout gl <- grid.layout(5, 5, widths=unit(c(1.8, 8, 0.8, 8, 0.8), "cm"),