Displaying 20 results from an estimated 1000 matches similar to: "R crashes using pdf() windows() or postscript()"
2010 Jul 22
5
legend in R plot
Hi all,
I am have some difficulty with the legend function.
I need to add a legend to describe the different line types in a plot. The
legend box is small.
It did not include sufficient length of each line type to help distinguish
the differnt line types.
Is there a way to fix this.
Thank you
Hannah
[[alternative HTML version deleted]]
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",
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))
2011 Mar 09
1
How does the cex parameter scale circles?
I'm wondering how the cex parameter is used to scale circles (i.e. does it scale the radius, diameter, area, circumference, etc.?). In my case I'm using lattice with filled circles (pch=19).
Based on example, it looks like R scales the radius of the circle:
library(lattice)
dta<-data.frame(x=rep(1,6),y=rep(1,6),sz=c(1,2,4,8,16,32))
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"))
2005 Jan 19
1
Should NEVER happen; please bug.report() [mkCLOSXP] (PR#7535)
I'm probably not using the function right, but anyway, the program said:
"please bug.report."
> w_R.f1=function(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),
+
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),
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
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().
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",
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 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),
2008 Jul 29
1
How to set the parameters in Trellis Graphics (by Lattice package)
Dear R users
I plot the trellis graphics by using the lattice package. Everything is
OK. Now, I want set
some parameters of the trellis graphics.
1. The tick label site. By default, only two tick labels had been output in
x-axis of my plot.
I want output four or five tick labels. In the traditional graphics system,
it will be very easy.
Just not output the axis in plot by use the parameter
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,
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
2008 Sep 26
2
adjusting textsize and spacing in mosaic (vcd package)
I'm trying to find a way to change the font size in a mosaic plot (the
grid version, not the base graphics one).
Here's an example to demonstrate:
#Basic plot
library(vcd)
mosaic(HairEyeColor, shade = TRUE)
#Bad first guess: this stops the default cell colouring, and doesn't
change the font size
mosaic(HairEyeColor, shade = TRUE, gp=gpar(fontsize=16))
#This successfully changes
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
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 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