search for: yscale

Displaying 20 results from an estimated 100 matches for "yscale".

Did you mean: scale
2011 Sep 15
1
Lattice xyplot log scale labels help!
...oduces a logged y-axis but the labels (e.g. "10^1.2") are not very user-friendly: xyplot(24:300~24:300, scales=list(y=list(log=T))) So, trying another y.scale.component function, we get something more agreeable for y-axis scale labels: xyplot(24:300~24:300, scales=list(y=list(log=T)), yscale.components = yscale.components.log10.3) However, my problem is that occasionally I'll have to plot data that doesn't quite "work". For example, in the following example, I only get one y-axis scale label: xyplot(11:30~11:30, scales=list(y=list(log=T)), yscale.components = ysca...
2007 Feb 21
3
Different gridlines per panel in xyplot
...uot;gray") How do I change this so that the horizontal gray gridlines are drawn at y coordinates where the y labels are drawn? The challenge is that each panel has different y-ranges (in my real example the y-ranges and y-intervals are even more different). For example, I wish I could use the yScale list as the h parameter in abline, but it does not work with a list. Thanks for any help. Rene library(lattice) Subj <- rep(1:4,each=3) Time <- rep(1:3,4) + 0.1 Conc <- (1:12) + 0.1 df <- data.frame(Subj,Time,Conc) xScale <- 1:3 yScale <- list(1:3,4:6,7:9,10:12) xyplot(Conc ~...
2008 Jan 31
1
decrease amount of ticks on y axis in lattice levelplot
...hich the z-values of the levelplot are the actual values in the matrix, whereas the row and column names are the x and y ticks (and thus character data). I guess that is character data is the root of the problem, but I don't know how to solve it. I tried to change the amount of ticks using yscale.components, but this doesn't work: yscale.components.myY <- function(...) { Y <- yscale.components.default(...) Y$left$ticks$at <- pretty(1,n=10) Y$left$labels$at <- pretty(1,n=10) return(Y) } print(levelplot(my_matrix),cuts=100,yscale.components=yscale.components.myY) My fu...
2008 May 06
1
Spacing between lattice panels
I'm trying to set up a lattice plot with two y-axes for each panel. (Yes, I know that multiple y-axes are generally a bad idea; the graph is for someone else and they want it that way.) I've used a custom yscale.component in xyplot to achieve this: myyscale.component <- function(...) { ans <- yscale.components.default(...) ans$right <- ans$left foo <- ans$right$labels$at ans$right$labels$labels <- as.character(10*foo) ans } xyplot(Sepal.Length ~ Petal.Length| Species, data = iri...
2009 Dec 02
1
barchart() {Lattice} -- auto.key()
..., row.names="Names") barchart(data.matrix(dta), horizontal=FALSE, stack=TRUE, par.settings = simpleTheme(col = 3:5), auto.key=list(space="right", rectangles=TRUE, points = FALSE), border=NA, scales = list(relation="free", y = list(at = yScale)), panel=function(x,y,...) { panel.abline(h=c(yScale), col.line="gray") panel.barchart(x,y,...) } ) Any help would be appreciated, Thanks, Peng -------------- next part -------------- Names Col1 Col2 Col3 Row1 -20 40 -10 Row2 30 -20 40 Row3 30 10 -20 Row4...
2004 Aug 27
1
Plotting irregular grid as image or persp
Hi, I have an array of 2d node locations and an array triangles, and would like to plot something like a image or persp. An example of doing it with rgl is: library(ncdf) library(rgl) # wget http://www.maplepark.com/~drf5n/extras/teapot.nc teapot<-open.ncdf("teapot.nc") z<-get.var.ncdf(teapot,"tris") l<-get.var.ncdf(teapot,"locations")
2011 Nov 09
1
Invalid 'yscale' in viewport
...a lovely bit of code called esplot() that makes scatterplots with associated histograms and rug plots. I have been trying to use it on my own data, but the viewport routine on which it depends (I think) is choking on the data I'm trying to plot. $ Error in valid.viewport(...) : Invalid 'yscale' in viewport When I Google this error, I see that others get this message when trying to plot dates. However, my data are two numeric vectors. The strange part is that these vectors are in fact date differences -- they started life as dates -- but I've already converted them to numeric,...
2009 Jul 21
2
animated grid graphics
...ated graphic and decided to use grid for it. A very simple example of what I need: ##============================================================================== library(grid) grid.newpage() pushViewport(plotViewport()) pushViewport(viewport(xscale = extendrange(c(0, 100)), yscale = extendrange(c(0, 100)))) grid.xaxis() grid.yaxis() rectNames <- paste("r", 1:100, sep = "") for (i in 1:100) { grid.rect(x = unit(sample(0:100, 1), "native"), y = unit(sample(0:100, 1), "native"), width = 0.1, height = 0.1, nam...
2008 Jun 30
1
Lattice : Single reference line/label at 0.05
...ne at y=0.05 as well... This is what I have so far. The label reads 0.0 and there is a grid instead of a single reference line. Can someone help please? Troy x<-18:35 (pv<-1/(x-17)) xydf<-data.frame(x, pv) print(xyplot(pv~x, data=xydf, type=c('p', 'g'), ylim=c(0,1), yscale.components= function(lim, ...) { ans <- yscale.components.default(lim = lim, ...) ans$left$ticks$at <- c(0.05) ans$left$ticks$labels$at <- c(0.05) ans$left$ticks$labels$labels <- c("0.05") ans } )) [[alternative HTML version deleted]]
2012 Sep 14
0
problem with user defined panel function in xyplot
...ay with it: ? library(zoo) library(latticeExtra) library(gpclib) ? setGeneric("translate.poly", function(x, ...) ?????????? standardGeneric("translate.poly")) ? setMethod("translate.poly", signature(x = "gpc.poly"), ????????? function(x, xscale=NA, yscale=NA, ...) { ????????????? x at pts <- lapply(x at pts, function(p) { ????????????????? if (!is.na(xscale)) p$x <- p$x + xscale ????????????????? if (!is.na(yscale)) p$y <- p$y + yscale ????????????????? p ????????????? }) ????????????? x ????????? }) ? ? setGeneric("flip.poly...
2012 Apr 01
0
lattice levelplot axis ticks labels
..."through time", ylab="depth", colorkey=list(col=heat.colors(20), ) ##I think this is how I can force ticks and labels on y axis based on help I saw on net, but I can't get it to work ## first make function to set up object to replace yscale.components.default - i think that gives the automated 'pretty' axes yscale.components.HEAT <- function(...) { ans <- yscale.components.default(...) ans$right <- ans$left ticklabels <- -1*seq(0,80,10) ans$left$ticks$at <- ticklabels ans$left$labels$a...
2007 Jun 18
1
Second y-axis in xyplot (lattice) where y1 and y2 have different ranges
Hi all, I realize this is asking a lot of lattice, but I want to add a second y axis inside a xyplot and have y1 and y2 have different ranges. Given dat below, I can add a second y axis by overlaying a new plot with par(new=T) and label axis 4 with standard graphics. I've seen an example for doing something similar in xyplot even though Deepayan has indicated that lattice isn't the right
2001 Nov 20
0
Summary: non-negative least squares
...- t(t(y) %*% X) A <- diag(ncol(X)) b <- rep(0,ncol(X)) fit <- solve.QP(D=D,d=d,A=t(A),b=b,meq=0) and the solution is in fit$solution Good luck, Gardar Marcel Wolbers wrote: Hi Bob I use the routine below which uses library quadprog for non-negative least squares. The scaling (xscale, yscale) is in principle unnecessary; it's only there because there's a minor bug in the library quadprog and the scaling is often a workaround. I don't know how this compares to Brian Ripleys suggestion (use optim) in times of speed and accuracy, but it should be competitive. Yours, Marcel...
2003 Jul 21
1
Lattice: how to draw some text outside the panel?
Dear r-help I draw plots with xyplot() function. Each plot contains also a line of regression. I want to write the trend value and its significance (obtained with lm()) below each panel. I use ltext() for this. But the text is cut, when it comes outside a panel. Moreover (obviously), it doesn't appear at all when its coordinates are outside a panel. Could you,
2012 Feb 16
2
Defining a viewport scale in {Grid}
...o redefine the viewport the polygons plot in the same places. I also get the same result without employing push/pop. (As you can see from the scale I'm trying to introduce, I want to plot map polygons.) Grateful for an idea where I'm going wrong. pushViewport(viewport(xscale=c(-180,180),yscale=c(-90,90))) grid.polygon(x=c(0,5,5,0)/100, y=c(0,0,5,5)/100, draw = T) grid.polygon(x=c(100,95,95,100)/100, y=c(100,100,95,95)/100, draw = T) grid.polygon(x=c(50,70,70,50)/100, y=c(50,50,70,70)/100, draw = T) grid.polygon(x=-c(10,10,40,40)/100, y=c(10,40,40,10)/100, draw = T) #NEGATIVE X grid.pol...
2010 Mar 29
1
xyplot second y-xis and legend
...E, text=LETTERS[1:4])) #to set a second y-axis with an other scale: # convert data to proper scale: inp3[which(inp3$group=="A"|inp3$group=="B"),"val"]<-inp3[which(inp3$group=="A"|inp3$group=="B"),"val"]*3 # set second y-axis myyscale.component <- function(...) { ans <- yscale.components.default(...) ans$right <- ans$left foo <- ans$right$labels$at ans$right$labels$labels <- as.character((0.3)*foo) ans } #plot with second y-axis. This does not work: xyplot(val~GF,groups= group, data=inp3,type="o&...
2018 Apr 25
1
Can't Get Lattice Histogram Minor Tick Marks to Work
...the program to see the problem. # Note how the histogram shows minor tickmarks on the vertical axis. # I would like to show only a SINGLE minor tickmark between major tickmarks on # the vertical axis, which helps to show the viewer that all the bars # in the left panel are at five percent. # The yscale.components.subticks function in the latticeExtras package # has arguments to contol the minor tickmarks, but I can't get them to work. # How can a get a single minor tickmark between the major tickmarks on # the vertical axis? # Thanks for your help, # Don Macnaughton donmac at matstat.com...
2002 Jun 17
1
Clusters of adjacent bars in barchart()
Can I create a barchart in lattice with clusters of adjacent bars, which is possible with barplot() when beside=TRUE? How can I accomplish the grouping in lattice that is done with inputting a matrix to barplot()? Thanks, Scott Waichler Hydrology Group/Environmental Technology Division Battelle Pacific Northwest National Laboratory ________________________________________________
2012 Aug 06
1
cannot find function "simpleRDA2"
...still an 'R' novice. Below is a reproducible example for you. Thank you always for all of your help. Lindsey example: X=matrix(rnorm(30),10,3) Y=matrix(rnorm(50),10,5) forward.sel.par <- function(Y, X, alpha = 0.05, K = nrow(X)-1, R2thresh = 0.99, R2more = 0.001, adjR2thresh = 0.99, Yscale = FALSE, verbose=TRUE) ## ## Parametric forward selection of explanatory variables in regression and RDA. ## Y is the response, X is the table of explanatory variables. ## ## If Y is univariate, this function implements FS in regression. ## If Y is multivariate, this function implements FS using th...
2011 May 14
1
Using dates on axis with Grid plots
...ate). I can transform the initial data from a date time string into POSIXlt or POSIXct, or Date objects. The issue is that when I try to layout the plot using: dev.off() pushViewport( plotViewport( c(5, 5, 4, 2), xscale=c( min(foo), max(foo)), yscale=c(0,30) ) ) I get this error, regardless of whether "foo" is formated as POSIXlt, POSIXct or Date for the xscale. Error in valid.viewport(x, y, width, height, just, gp, clip, xscale, yscale, : Invalid 'xscale' in viewport How does one specify the scale? In the end, I wo...