search for: npc

Displaying 20 results from an estimated 175 matches for "npc".

Did you mean: np
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", "white"), space="Lab"...
2009 Oct 27
0
boxplot using grid
...ather, the data do not match the axis. Below is the function and code run. I am using R2.9.0 # Function bxplt <- function(x, range = 2){ require(grid) bxp <- boxplot(x, range = range, plot = FALSE) O <- bxp$out On <- length(O) grid.yaxis() grid.lines( rep(unit(0.5, "npc"), 2), c(unit(bxp$stats[1], "native"), unit(bxp$stats[5], "native")), name = "whiskers" ) grid.rect(x = unit(0.5, "npc"), y = unit(0.5, "npc"), just = c("centre", "bottom"), height = unit(bxp$stats[4],...
2009 Feb 11
1
Help with XYPLOT with marginal histograms
...umentation and others and also searched the lists. Below is sample code that demonstrates where I'm at (it should paste and run within an R command prompt. I'm running 2.8.1): THANKS!!! <snip> library(lattice) library(grid) v1 = viewport( width=unit(0.8,"npc"), height=unit(0.8,"npc"), just=c("left","bottom"), x=unit(0.0,"npc"), y=unit(0.0,"npc"), name="v1" ) v2 = viewport( width=unit(0.8,"npc"), height=unit(0.2,"npc"), just=c("lef...
2009 Jun 26
1
gradient fill of a grid.polygon
...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), -sin(angle), sin(angle), cos(angle)), nrow = 2) gravity.x = unit(mean(g$x),"npc") gravity.y = unit(mean(g$y),"npc") x.center = convertX(g$x - gravity.x ,"npc",TRUE) y.center = convertY(g$y - gravity.y ,"npc",TRUE) new.xy <- matrix(c(x.center, y.center), ncol=2) %*% matR editGrob(g, x=unit(new.xy[,1],"npc")...
2009 Sep 24
1
Creating grid graphics with grid.layout
...(2,2), (4,2), (2,4), and (4,4). Here's the viewport code: pushViewport( viewport( layout=grid.layout( nrow=5, ncol=5, widths=unit( c(margin[2],1,margin[6],1,margin[4]), c('npc','null','npc','null','npc')), heights=unit( c(margin[3],1,margin[5],1,margin[1]), c('npc','null','npc','null','npc')) ) ) ) margin is a...
2009 Jun 23
2
curvedarrow (some graphics problem)
Hi there, I just wonder how to draw this kind of picture... http://www.nabble.com/file/p24158796/b.jpg http://www.nabble.com/file/p24158796/a.jpg and this is what i have done %%%%% library(shape) library(diagram) curve(sin(x),bty="n",-8,8,yaxt="n",ylab="",xaxt="n",type="n",xlab="") axis(1,labels=F,at=seq(-8,8,1))
2005 Mar 09
4
Lattice device page options-margins
I am using lattice to make figures as pdfs: trellis.device(device = "pdf",file = "Figure6.pdf",color = FALSE) I need to specify some blank space on the left-hand margins (the pages will be bound so we need about 0.5 inch)). I have tried a number of solutions but none seems to work (e.g. par.set). Can this be done when initiating the plotting device? Or is the some other way
2008 Sep 01
1
npc to native coordinates for xyplot
...I am having trouble adding symbols to grid graphics. I am able to create a lattice scatterplot using xyplot, which has a range from -15:15 in both the X and Y directions. However, when I try to add circles and text to this graph using grid.circle() and grid.text(), they are offset using the default npc coordinates. Nothing happens when I pass the parameter default.units="native" to grid.circle, as suggested in this post:http://tolstoy.newcastle.edu.au/R/e4/help/08/03/5534.html. I also tried replicating the code in Paul Murrell's GridBase documentation, but to no avail: xyplot(y ~...
2009 Sep 02
2
combining grid.text, expression and variables
...uot;confidence interval on percentiles", sep=" "))), bquote(expression(paste(95^th,"confidence interval on percentiles", sep=" "))) ) grid.newpage() for (i in c(1,3,4,5,6)) { grid.text(eval(vp.ref[i]), x=0.5, y=unit(1,"npc")-unit(i,"lines")) }
2011 Feb 15
1
gList and gTree methods of grid::grobX
Dear all, In an attempt to draw fill patterns in grid graphics, I have encountered a behavior of grobX that I cannot understand from the documentation. Consider this, library(grid) ## gTree g1 <- gTree(children=gList( rectGrob(0.5,0.5, width=unit(0.8,"npc"), height=unit(2,"cm")), circleGrob(r=0.3)), vp=viewport(0.5,0.5)) ## gList g1 <- gList(rectGrob(0.5,0.5, width=unit(0.8,"npc"), height=unit(2,"cm")), circleGrob(r=0.3)) ## loop over angles t...
2005 Oct 15
2
grid.edit problem
I am having a problem in editing a grob. It works ok if I try to shift the grob using npc coordinates but if I do the same thing using native coordinates the grob disappears. What is wrong? library(grid) grid.newpage() # create viewport pushViewport(viewport(xscale = c(100,200), name = "X")) # draw vertical line grid.lines(150, 0:1, default.units = "native", na...
2009 Sep 28
2
dichromat, regexp, and grid objects
...red-green colour blindness, protanopia and deuteranopia." library(dichromat) library(grid) colorStrip <- function (colors = 1:3, draw = TRUE) { x <- seq(0, 1 - 1/length(colors), length = length(colors)) y <- rep(0.5, length(colors)) my.grob <- grid.rect(x = unit(x, "npc"), y = unit(y, "npc"), width = unit(1/length(colors), "npc"), height = unit(1, "npc"), just = "left", hjust = NULL, vjust = NULL, default.units = "npc", name = NULL,...
2010 Feb 22
1
grid unit bug? (PR#14220)
The following seems to me to be at least a perverse trap, if not an = outright bug: > is.numeric(unit(1,"npc")) [1] TRUE > is.numeric(1*unit(1,"npc")) [1] FALSE > is.numeric(unit(0,"npc") +unit(1,"npc")) [1] FALSE ...etc. i.e. is.numeric() appears to be TRUE for class "unit" but false for = class ("unit.arithmetic" "unit" ). Seems to...
2009 Mar 21
1
Forestplot () box size question
...") || stop("`grid' package not found") require("rmeta") || stop("`rmeta' package not found") drawNormalCI <- function(LL, OR, UL, size) { size = 0.75 * size clipupper <- convertX(unit(UL, "native"), "npc", valueOnly = TRUE) > 1 cliplower <- convertX(unit(LL, "native"), "npc", valueOnly = TRUE) < 0 box <- convertX(unit(OR, "native"), "npc", valueOnly = TRUE) clipbox <- box < 0 || box > 1 if (clipup...
2008 Jul 28
1
grid.ls() after grid.remove() fails
...dList(x, grobs = grobs, viewports = viewports, fullNames = fullNames, recursive = recursive) 2: grid.ls(print = FALSE) 1: str(grid.ls(print = FALSE)) > str(current.vpTree()) List of 17 $ x :Class 'unit' atomic [1:1] 0.5 .. ..- attr(*, "unit")= chr "npc" .. ..- attr(*, "valid.unit")= int 0 $ y :Class 'unit' atomic [1:1] 0.5 .. ..- attr(*, "unit")= chr "npc" .. ..- attr(*, "valid.unit")= int 0 $ width :Class 'unit' atomic [1:1] 1 .. ..- attr(*, "unit&q...
2008 Dec 21
6
Games performance with wine
....34GhZ Graphic Card - Palit Geforce 7300GS Ram - 2GB @ 800MhZ Wine version: 1.1.10 Ubuntu version: 8.10 with all the updates Games I tried to run: Steam - works, but when I switch to games list, even it's windows moves very slowly Half-LIfe 2 (steam) - only 5-7 fps GTA San Andreas - when many NPC's appear on screen it's getting laggy. When I turn my back to NPC's it's fine again.
2007 Dec 10
2
Viewport and grid.draw
...lot1, split=c(1,1,2,4), more=TRUE) print(plot4, split=c(2,1,2,4), more=TRUE) print(plot2, split=c(1,2,2,4), more=TRUE) print(plot5, split=c(2,2,2,4), more=TRUE) print(plot3, split=c(1,3,2,4), more=TRUE) print(plot6, split=c(1,4,1,4), more=FALSE) grid.text(vp=do.call(viewport,grid.locator(unit="npc")), label='A', gp=gpar(fontsize=20)) grid.text(vp=do.call(viewport,grid.locator(unit="npc")), label='B', gp=gpar(fontsize=20)) key1<-draw.leg(key=list(text=list(c('some text', 'text2')),points=list(pch=c(17,15)))) vp.key<-viewport(grid.locat...
2011 Nov 18
1
How to fill irregular polygons with patterns?
...king 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", alpha=0.9)) tmp=seq(0.225,0.7,0.075) for(i in 1:length(tmp)) { grid.abline(intercep=tmp[i], slope=0, units="npc", range=c(0.21,0.79), gp=gpar(lty=c("F8","2"), lwd=1.1)) } tmp2=seq(0.265,0.685,0.075) for(i in 1:length(tmp2)) { grid.abline(intercep=tmp2[i], slope=0, units="npc", range=c(0.225,0.775), gp=gpar(lty="F8", lwd=1.1, col="red")) }...
2007 Sep 13
1
minimize white space around lattice plot
...actual plot. The problem now is, that there is lots of sourounding white space around my inner plot. Here is an example: panel.inset <- function(..., inset, drawRect=TRUE, ixpos=unit(0, "mm"), iypos=unit(1, "npc"), ijust=c("left","top"), iwidth=unit(0.7, "npc"), iheight=unit(0.5, "npc")) { ## open our viewport ... pushViewport(viewport(x=ixpos, y=iypos, width=iwidth, height=iheight, just=ijust, name="inset...
2008 Nov 19
1
Buggy trellis.focus() with xyplot ?
...e it bigger than the initial size. *** To Fix the bug: I tried to fix this bug in interraction.R but I was unsuccesful. The problem should stem from the a bad calculation of the pads in the follwoing lines : leftPad <- convertX(sum(glayout$page.layout$widths[1:(colRange[1]-1)]), "npc", valueOnly = TRUE) rightPad <- convertX(sum(glayout$page.layout$widths[(colRange[2]+1):layCols]), "npc", valueOnly = TRUE) topPad <- convertY(sum(glayout$page.layout$heights[1:(rowRange[1]-1)]), "npc", valueOnly = TRUE) botPad <- convertY(s...