Displaying 20 results from an estimated 8000 matches similar to: "grid and ps device (bg-color)"
2005 Dec 08
1
grid graphics gpar(fill) argument and jpeg device
Hi everybody,
I just notice a strange behaviour of gpar's fill argument when using
non-postscript devices:
The default of the argument is transparent (according to get.gpar("fill")).
So as expected, the following code draws a nice red rectangle in the
middle of my X11 or postscript device.
pushViewport(viewport(width=0.5, height=0.5))
grid.rect(gp=gpar(fill="red"))
2012 Sep 23
1
Background color in a grid plot seems to interfere with plot()
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"),
heights=unit(c(0.8, 8, 0.8, 8, 1.5), "cm"))
if(FALSE) grid.show.layout(gl)
2008 Aug 06
1
grid layout scaling viewport width based solely on height
Hello all,
I'm trying to write a function that produces a main plotting region
with several square plots along the right side. Ideally the size of
right side plots will scale only with the height of the entire plot,
yet never overlap with another secondary plot. The following two
snippets get close, however, as I resize the plot horizontally the
right side plots (green squares) get smaller
2012 Oct 09
2
plot.new() and grid functions in multipage pdfs
Hi,
when using the grid package, I've come across this weird behaviour
where a call to plot.new() will start a new page for a multi-page pdf,
but then the margins will somehow behave strangely for all but the
first page: here is some code:
pdf("test.pdf"); plot.new(); grid.rect(gp = gpar(fill="blue"));
plot.new(); grid.rect(gp = gpar(fill="blue")); dev.off()
2008 Aug 17
1
Making use of names of viewports (grid)
The following code, though not brilliant, works on an A4 page. It
might look odd on other devices of a very different size.
=============X8------- cut here ----------------------------
require(grid)
wide <- 15
vps <- grid.layout(nrow = 3, ncol = 4,
widths = unit(rep(1, 4), rep("null", 4)),
heights = unit(c(99, 1, 99),
2008 Aug 08
2
gridBase and new.page() / grid.newpage()
Hello all,
I'm trying to write a function using the gridBase package. I'd like
to push several base subplots to a larger plot constructed with grid.
However, I'm having trouble getting consistent results when running
the function when the plotting window (quartz) is closed, when it is
left open and the plot function is repeated to the same window, and
when the output is saved to a
2020 May 19
2
Graphic parameters with length zero in grid cause R to crash
Hi,
I found in grid package, if the graphic parameters have zero length, R crashes. In the
following code, I only tested `grid.rect()` and the `fill` parameter, but I think it should
be similar as other grid graphic functions.
In `gpar()` function, the graphic parameters are not allowed to have zero length, but
we can make them with zero length by first generating a `gpar` object and then
2009 Jun 24
1
parallel rotated strips with color gradient
Hi,
I want to produce two parallel rotated strips with color gradient. So
far, the sample strip is something produced by this:
pushViewport(viewport(x = unit(0.638, "npc"), y =unit(0.386, "npc"),
width=.62, height=0.006, angle=137.2))
grid.rect(y=100:1/100, just="top",
gp=gpar(col=NA,
fill=colorRampPalette(c("lightgray",
2010 Oct 01
2
strange interaction between rasterImage and Grid graphics
Dear all,
This may be specific to Mac, I haven't had a chance to test another
platform. Consider this,
plot(1,1,t="n")
rasterImage(matrix(1),1,1,1,1)
library(grid)
grid.rect(gp=gpar(fill="grey"))
The grid.rect covers the full device window as expected. However, when
I resize the window ever so slightly (interactive device) the rectGrob
is suddenly clipped to the previous
2010 Oct 20
1
need for speed on grid.rect
When I use grid.rect to print a multi-coloured grid, it is incredibly slow compared to a single colour grid, or even a two colour grid.
I've set out some simplified examples below. This is something I run literally thousands of times a day, so I would greatly appreciate any hints on how I might improve the speed???
library(grid)
pushViewport(viewport(
width = unit(100,
2011 Aug 12
1
Grid unit width and font face
Dear R-users,
When one defines a grid unit object using the 'strwidth' dimension, it
seems that the default plain font is assumed as the following example
illustrates. Is there a way to either make use of a font option when
creating a unit object or to know the factor that exists between the
width of the same text printed in plain and in bold? This might be
dependent on the font,
2003 Feb 21
5
Problem Writeing a pipe using R (stdin is consumed)
Hi everybody,
I a, trying to use R as a pipe like this:
cat inputData | R --silent RCommandFile >outputData
The RCommandFile would contain something like readLines(stdin()).
I have tryed various things and none did work cleanly.
One possible solution is to use the pipe() function inside R and to pass in the "cat inputData" however this is not very convenient
since I would like to
2008 Mar 04
1
grid.layout?
platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 2
minor 6.2
year 2008
month 02
day
2005 Mar 17
1
Varying grid.rect in different panels of a Lattice plot
Dear r-help,
Sleep-deprivation from having 2 youngsters under 2 around the house is
fuzzing my brain, so please be gentle if the answer to this query is obvious!
In the example below, I'm trying to use grid.rect to add grey rectangles to
the panels of a lattice plot to indicate which months spawning occurred of
a (very cute) native Tasmanian fish. The fish in the two lakes spawned at
2003 Jul 21
1
grid and gtkDevice package clipping bug.
Hello!
When I draw points on grid's viewport with clip set to TRUE clipping
does not have effect on some symbols. It happens only when drawing over
gtkDevice (GTK ver. 1.2) (with postscript device clipping works OK -
take a look at this screenshot
http://www.hppi.troitsk.ru/Kondrin/clipbug.png) and only with symbols
that are drawn with commands other than gdk_draw_polygon() (i.e. circles
2004 Jun 28
1
text length in grid
Hello! I first would like to compliment the authors of grid on what has been
a wonderfully useful package for me. Now, my question: Is there any way I
can specify the size of some grid.text using grid units?
I must label the regions of a plot. The regions can be either very small or
very large, so I would like to label each by fitting its text to the size of
the region in question. Ideally, I
2010 Aug 04
1
gpar fill and transparency on devices
Dear list,
I'm puzzled by the graphical output in the following example,
library(grid)
foo <- function(){
grid.rect(gp=gpar(fill="black"))
print(get.gpar()$fill)
grid.rect(width=0.2,height=0.2)
}
png("test.png", bg = "transparent")
foo()
dev.off()
png("test1.png", bg = "white")
foo()
dev.off()
It seems that the default value of
2012 Sep 27
1
Problem with grid.rect
I have a stupid problem that is currently driving me crazy...
Let us suppose that I want to draw a big red square in the middle of my
current device (say X11)
I tried the following code :
pushViewport(viewport(xscale=c(0,1), yscale=c(0,1)), just=c("center", "center"))
vp1 <- viewport(x=unit(0.5, "native"), y=unit(0.5, "native"),
width=unit(0.4,
2010 Nov 20
1
Grid newbie: aligning & scaling viewports
Oh Knowledgeable Ones:
I'm working on a project using grid graphics (for the first time). A toy
example is given below, run it simply with >foobar() I am wondering why the
pink dot and concentric circles are not centered on the 3-color axis system.
Further, I feel like the concentric circles don't have the intended radius -
if my math is right, the outmost circle should touch the
2008 Apr 08
2
diagonally fill a rectangle with color gradient
Hi,
Is it possible to diagonally fill a rectangle with a color gradient? I
noticed that the gradient.rect of plotrix could fill a rect either up and
down or from side to side. I am looking for something similar but fills
diagonally instead, e.g., from the upper left corner to the bottom right.
Does anyone know how to do it in R?
Thanks,
--
Tom
[[alternative HTML version deleted]]