Displaying 20 results from an estimated 282 matches for "gpars".
Did you mean:
pars
2009 Dec 03
2
Passing arguments to gpar
Dear R-users,
I would like to know how to pass arguments to gpar() without hard-coding
them. I tried to store my arguments in a list and passed this list to
gpar(), but it did find the way to do it properly. Any help would be
appreciated.
a<- list(fontisze=8,col=3)
gpar(fontsize=8,col=3)
gpar(a)
gpar(unlist(a))
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"))
2011 Nov 18
1
How to fill irregular polygons with patterns?
Hi,
I'm looking the best way to fill irregular polygons with patterns,
Something like the function grid.pattern do, but my case is with
irregular polygons.
Whit this script I can get it, but I'm looking for an "elegant" solution..
library(grid)
grid.polygon(x=c(0.2, 0.8, 0.6, 0.6, 0.8, 0.2),
y=c(0.2, 0.2, 0.3, 0.5, 0.7,0.7),
gp=gpar(fill="grey",
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
2005 Jan 19
1
Should NEVER happen; please bug.report() [mkCLOSXP] (PR#7535)
...tion(PR,Pc) return (Pc*PR^3)
>
> w_R.f2=function(PR,Pc) return (Pc*PR)
>
> w_R.fc=c(w_R.f1,w_R.f2)
> w_R.fc[2]
[[1]]
function(PR,Pc) return (Pc*PR)
>
> RSD(type=3,
+ gparP=gpar(col="red"),
+ gparD=gpar(fill=FALSE,col=FALSE),
+ gparL=gpar(col="red",lwd=2),
+ gparSL=gpar(col=grey(0.5),lwd=2),
+ gparS=gpar(fill=FALSE,col=FALSE),
+ gparSP=gpar(col=grey(0.7)),
+ w_R.f=w_R.fc[2]
+ )
Error in R2SDgraph(...) : couldn't find function "w_R.f"
> as.function(w_R.fc[2])
Error in as.function.default(w_R.fc[2]) : invalid body argument for
"function&q...
2009 Mar 21
1
Forestplot () box size question
Hi All,
I have been able to modify the x-axis to start at zero by adding xlow
and xhigh parameters; that was pretty simple. I have been unable to
find the location of the code that would turn off the information
weighting of the box size (I have smaller randomized trials getting
less weight than a much larger non-randomized trial). The function
is forestplot() from rmeta.
Thanks for any
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),
2007 Sep 19
4
fontsize in mosaic plot lables
Hi List,
I am trying unsucessfully to modify the fontsize of lables in mosaic:
require(vcd)
mosaic(Titanic, pop=FALSE,
labeling_args=list(rot_labels=c(bottom=90,top=90),
set_varnames = c(Sex = "Gender"),
gp_text=gpar(fontsize=20))) #can't get it to resize text
tab <- ifelse(Titanic < 6, NA, Titanic)
# it works for labeling_cells
labeling_cells(text = tab,
2007 Jul 24
1
How to add circular text for a graph with concentric circles
Dear R experts,
I am plotting the population of students who live in a city, and in
successive circular bands made of the contiguous districts that surround
the city. This is a stylized figure, where I specify the area of each
successive circle based on the cumulative population of students. I want
to compare two sets of concentric circles across different populations -
such as 'All
2008 Jan 12
2
Lattice equivalent of par(mfrow = )
Dear r-helpers,
Does anyone have a straightforward example of putting together three
unrelated (expect for a common y-axis) xyplot() figures in what would
be in base graphics a par(mfrow = c(1, 3)) arrangement?
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102
2006 Aug 01
1
R crashes using pdf() windows() or postscript()
Dear HelpeRs,
I have a script where I save several thousands of graphics. These are
then used in Latex through Sweave. Unfortunately R crashes while making
these plots and Windows pops up some message that I run low on virtual
memory. I tried to save the plots using pdf(), windows() and
postscript() and also tried to run it with R CMD BATCH myscript.R. But
after a while R slows down and crashes
2009 Sep 19
1
matrix operations on grobs and grid units
Dear list,
As a minimal test of a more complex grid layout, I'm trying to find a
clean and efficient way to arrange text grobs in a rectangular layout.
The labels may be expressions, or text with a fontsize different of
the default, which means that the cell sizes should probably be
calculated using grobWidth() and grobHeight() as opposed to simpler
stringWidth() and stringHeight().
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
2001 Nov 27
1
What name-value pairs can be used in gpar()?
To use grid graphics with lattice, the help for gpar indicates that
any number of named arguments can be specified but where do we find
what names make any sense?
I have ascertained that fontsize is given in points such as one
would use in a postscript device argument and uses that same name.
It's not as I'd have thought, something corresponding to cex in
regular par() settings.
2004 Nov 22
4
How to correct this
Hi there,
I tried to add a few circles on an existing figure using the following
codes
grid.circle(x=0.5, y=0.5, r=0.1, draw=TRUE, gp=gpar(col=5))
grid.circle(x=0.5, y=0.5, r=0.3, draw=TRUE, gp=gpar(col=5))
grid.circle(x=0.5, y=0.5, r=0.5, draw=TRUE, gp=gpar(col=5))
points(0.5, 0.5, col = 5) # centre of the circle
, but all circles moved away from the centre. Could we do any
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",
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
2009 Jun 26
1
gradient fill of a grid.polygon
Dear list,
Following a recent enquiry, I've been playing with the idea of creating a
colour gradient for a polygon, using the Grid package. The idea is to draw a
number of stripes of different colours, using the grid.clip function. Below
is my current attempt at this,
library(grid)
rotate.polygon <- function(g, angle=0){ # utility function, works fine
matR <- matrix(c(cos(angle),
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 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