similar to: conditioning variable in panel.xyplot?

Displaying 20 results from an estimated 10000 matches similar to: "conditioning variable in panel.xyplot?"

2010 Jun 22
2
Lattice legend
I have a moderately complex graph with three panels. There are data points plotted, and fitted lines are added using a panel function, which includes "with(alt.data[[which.packet()[1]]]" statements. It all graphs out beautifully, but none of the usual tricks to get the proper legend to plot are working, i.e., using auto.key, key, etc. One message I keep getting is Error in
2009 Dec 29
4
subsetting by groups, with conditions
I have a data set similar to this: P1id Veg1 Veg2 AreaPoly2 P2ID 1 p p 1 1 1 p p 1.5 2 2 p p 2 3 2 p h 3.5 4 For each group of "Poly1id" records, I wish to output (subset) the record which has largest "AreaPoly2" value, but only if
2011 Mar 01
2
Does POSIXlt extract date components properly?
I would like to use POSIX classes to store dates and extract components of dates. Following the example in Spector ("Data Manipulation in R"), I create a date > mydate = as. POSIXlt('2005-4-19 7:01:00') I then successfully extract the day with the command > mydate$day [1] 19 But when I try to extract the month > mydate$mon [1] 3 it returns the wrong month. And
2009 Sep 18
1
xyplot: Can I identify groups but not use them for regression?
I wish to identify groups representing different treatments, but to plot them and do a regression using a continuous variable ("cover") ignoring the groupings. d$year <- NA d$year <-c(rep(2007,12), rep(2008,12)) d$treatment <- c(rep("A",4),rep("B",4),rep("C",4), rep("A",4), rep("B",4), rep("C",4)) d$cover <-
2010 Mar 15
1
Eliminate border in wireframe plot
How can I eliminate the border drawn by default around a wireframe plot? I've tried using border=NA and box=FALSE to no avail. Scott Waichler Pacific Northwest National Laboratory scott.waichler at pnl.gov
2011 Sep 09
1
Adding groups to regression line panel function in Lattice
I wish to display a single-panel Lattice figure with grouped data and fitted regression lines. I don't seem to be able to get the individual regression lines to display, e.g.; d <- data.frame(q = rep(1:6, each=10), cc = rep(seq(10,100, 10),6)) # create data frame with group identifier 'q', independent variable cc d$ba = d$q*0.1*d$cc + 5*rnorm(nrow(d))
2007 Dec 13
2
Overlaying trellis xyplot on contourplot
Friends: I wish to overlay data points on a contour graph. The following example produces a nice contour plot, but I have not mastered the concept of using panel functions to modify plots. Can someone show me how to overlay the data points (given after contour plot statement) on the contourplot? --Seth model <- function(a,b,c,X1,X2) # provide model function for contour
2011 May 25
3
Accessing elements of a list
I have a list that is made of lists of varying length. I wish to create a new vector that contains the last element of each list. So far I have used sapply to determine the length of each list, but I'm stymied at the part where I index the list to make a new vector containing only the last item of each list mylist =
2010 Sep 21
1
Doing operations by grouping variable
I'm writing an expression that requires searching a vector according to group. As an example, I want to find the maximum value in each of 5 groups. group=rep(1:5, each=5) # create grouping variable variable=rnorm(25) # generate data d <- data.frame(group,variable) # make data frame
2012 Mar 23
1
Remove wireframe outer box but keep ticks
I would like to eliminate the outer box around a lattice wireframe graph, but the usual recommended solution, which is to assign a color of 'transparent' to the axis.line parameter, eliminates ticks if the 'arrows=F' command is used, as shown in the following example: test = data.frame(expand.grid(c(1:10), c(1:10))) z = test[,1] + test[,2] test = cbind(test, z) names(test) =
2012 Mar 29
1
How to access value of the conditioning variable in my panel
Hi, I have 10 panels in the "mypanel" function of my xyplot based on the conditioning variable and I want to print those ten values, panel headings, groups, .. whatever you want to call them. Easiest way please! Fayez [[alternative HTML version deleted]]
2007 May 09
1
How to remove outer box from Wireframe plots?
I would like to remove the outermost box from my wireframe plots -- this is the box that is automatically generated, and is not the inner cube that frames the data. There was a thread on this 4 yrs ago but none of the fixes work (e.g., grid.newpage(), grid.lines(gp = gpar(col = NA)) or par.box=list(col=1),col=NA. These just make the data or the cube disappear. Has anyone solved this issue?
2008 May 30
1
Question about adding text to xYplot(Hmisc)
Hello, I have been trying to make a graph that have error bars and text at specific position. I used the following code from the help file of xYplot(Hmisc) as an example except I add a myPanel function, which is just supposed to add letters from the alphabet at the position aligned at y = 3. It constantly gives me error: "Error using packet 1 argument "subscripts" is
2010 Jan 24
1
lattice ltext
Dear friends - please give me a hand. I have a dataset of 40 patients in two groups observed on three occasions. I only want to plot a line for each patient in the two groups. I use the ltext function to put the patient number but fail to make lattice understand the numbers as unique since apparently it starts all over with 1:20 for each panel instead of respecting my desires to have 1:20
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
2008 Dec 03
1
how do I eliminate excess levels in lattice contourplot key / legend?
I'm working on a contourplot( ) graph, the subject of several previous posts to this list. The contours express probabilities from 0 - 1, but the key that is automatically generated by contourplot pads the probability scale with values that are impossible (i.e, range goes from -0.2 to 1.2), which will be confusing to those who view the plot. How can I get the scale to just run from 0 - 1?
2009 Mar 23
1
using xyplot
Dear R-sians! I am trying generate a bunch of xyplots library(lattice) myPanel <- function(x,y,xl=range(x),yl=range(y),...) { panel.xyplot(x,y, pch=20,col='blue',cex=0.7,xlim=xl,ylim=yl,...) panel.abline(v=0, col='gray30',lty=2,lwd=1.5,...) panel.loess(x,y, span=2/3,family='gaussian',normalize=T,col='red',lwd=1.5,...) #
2012 Mar 10
1
Use different panel functions with lattice
Hi, I have a data.frame df with names(df) = c("Var1", "Var2", "Var3", "Var4") and I plot data with xyplot(Var1+Var2~Var3|Var4, data=df) I want to use different panel functions for Var1 and Var2. How can I do ? Something like : panel.mypanel = function(x, y, ...) { if (Var1) panel.Var1Panel(x, y, ...) else panel.Var2Panel(x, y, ...) }
2008 Mar 27
1
panel function question
I have two data sets with locations, X, Y of houses (df.house) and habitats(df.habitat), respectively. In each dataset, there are 3 replicates (Repeat). Because each replicate has different locations of houses and habitats, I would like to plot them in panels. I wrote something like this: mypanel<-function(x,y,subscripts,...){ panel.xyplot(x,y,pch=20) panel.xyplot(
2009 Nov 26
1
lattice --- different properties of lines corresponding to type=c("l", "a") respectively
I think the subject says it all. I want to make a simple lattice plot, using xyplot with the argument type=c("l","a"). The problem then is that in the resulting plot it is difficult/impossible to see which plot corresponds to the average and which to the individual profiles. I triedthings like extra arguments lwd=c(1,3) or col=c("blue","red") hoping