similar to: call lattice function in a function passing "groups" argument

Displaying 20 results from an estimated 10000 matches similar to: "call lattice function in a function passing "groups" argument"

2008 Jan 23
1
adjusting y axis labels in lattice plots?
Are there parameters that would allow adjusting y axis labels in lattice plots? E.g in the following simple example require(lattice) xyplot(rnorm(10) ~ 1:10, scales=list(alternating=2)) it would be nice to have the y axis labels adjusted to the right or at the decimal point instead of left adjustment. Thomas Zumbrunn -- Thomas Zumbrunn Institute of Zoology, University of Basel Vesalgasse
2008 Jan 31
3
X11 device distortion (PR#10666)
Full_Name: Thomas Zumbrunn Version: 2.6.1 OS: GNU/Linux (openSuse 10.3 2.6.22.13-0.3-default) Submission from: (NULL) (131.152.125.199) With my particular X11 settings, the width to height ratio of the x11 device is distorted, with the width being half that of the height. This results in wrongly proportioned plots, wrongly positioned text etc. Other devices are not affected. I already asked
2012 Jan 01
1
How to pass in a list of variables as an argument to a function?
Hello, I have some code that currently works fine and I am endeavoring to convert the major pieces of it into functions. This involves taking "hard coded" names of variables that are used in various places and figuring out how to abstract them out into functions where the arguments (i.e. a list of variables)?can be passed to the parent function and used within that function for various
2010 Dec 15
1
Problems drawing a colored 'rug' in the Lattice 'densityplot'
Hi All, I'm trying to add a 'rug' representation of my data to a plot created with densityplot(). While I can do this in the simple case, I can't do it properly when I include the "groups" argument. I have an example below. I am running a reasonably new version of R. print(sessionInfo()) R version 2.12.0 Patched (2010-11-07 r53537) Platform: i686-pc-linux-gnu
2008 Aug 26
2
awkward behavior with densityplot function
Hi, I have the following script: ---- t.R --- grafica <- function() { v <- read.csv('preprocessed/komolongma.ece.uprm.edu.active',sep=',') x <- as.ts(v$active) bitmap(file="output.png") densityplot(~x,col='blue',main='Density Plot') dev.off() } grafica() ---- t.R --- When I "sourced" it from R prompt, it quietly runs.
2012 Apr 11
1
Lattice densityplot with semitransparent filled regions
Hello, I'm doing some graphics for a paper and a need customize such with filled region above the density curve. My attempts I get something very near what I need, but I don't solve the problem of use semitransparent filled. Below a minimal reproducible code. Someone has any idea? require(lattice) # toy data... dt <- expand.grid(A=1:2, B=1:3, y=1:50) dt$y <- rnorm(nrow(dt), dt$B,
2009 Jun 02
1
lattice: horizontal alignment of labels in key
Dear R users I have problems horizontally aligning labels in keys of lattice plots when the labels make use of plotmath. Here's a self-contained example: dat <- data.frame(x = rnorm(10), y = rnorm(10), z = factor(rep(c("a", "b"), each = 5))) xyplot(y ~ x, dat, groups = z, auto.key = list(columns = 2, text =
2004 Oct 12
1
lm#contrasts#one level in factor: bug or feature
(R.1.9.1; win2000) Since it's about the tenth time I had to write an "if" around this to catch the error ... Let's look at the line myfit<-lm(res~groupvar,data=Data) Here res is of numeric type and groupvar is a factor. On first sight, it would be logical that if groupvar had only one (single) level we would get: Error in "contrasts<-"(`*tmp*`, value =
2002 May 16
1
Factors in lattice
Using one numeric and 2 factor variables densityplot( ~ Numeric | Factor1, ...) densityplot( ~ Numeric | Factor2, ...) .. both work, but densityplot( ~ Numeric | Factor1*Factor2, ...) produces the error Error in if (!(lo <- min(hi, IQR(x)/1.34))) (lo <- hi) || (lo <- abs(x[1])) || : missing value where logical needed None of the variables contain missing values. Any ideas
2003 Jan 08
1
Lattice: Plotting two densities on the same plot(s)?
I am trying to plot two density lines on the same graph. Using the functions on the base package, I would go: plot(density(x), col = 1) lines(density(y), col = 2) And I get two distinct (one-bump) density lines. When I try to do it using lattice, I get two two-humped lines. (In other words, I think the smoothing function is taking the next set of data points and smoothing them in the same
2009 Jan 25
1
Multiple lattice plots on a page: aligning x-axes vertically
Dear R-help, I am creating a two lattice plots (a densityplot() and xyplot()) that have the same x-axes and then 'printing' them onto the same page, one above the other (see end of email for an example to generate the graph). With different labels on the y-axis for each plot the left spacing is different, and the x-axes don't align vertically. Although I can manually modify the
2012 Nov 20
1
lattice density plot: add vertical lines at groupwise medians for all panels
Suppose you have the following code: ########## Start code########## data(Chem97, package="mlmRev") densityplot(~gcsescore | factor(score), groups=gender, data=Chem97, auto.key=TRUE, plot.points=FALSE, ref=TRUE, panel=function(x,...){ panel.densityplot(x,...) median.values <- median(x)
2009 Dec 02
1
Lattice: multiple data sets on same plot
Hi, I have two data sets; one is a population and the other a sample of that population. I am trying to plot both on the same trellis display. # Example data set with two numerical attributes and two categorical pop <- data.frame(var1=rnorm(2000, 2000, 500), var2=rnorm(2000, 2000, 500)) cat<-(runif(2000)<=.5)+0 for(i in 1:length(cat)){ if(cat[i] == 0){ pop[i,"cat1"] =
2004 Mar 19
2
using "unstack" inside my function: that old scope problem again
I've been reading the R mail archives and I've found a lot of messages with this same kind of problem, but I can't understand the answers. Can one of you try to explain this to me? Here's my example. Given a regression model and a variable, I want to use unstack() on the vector of residuals and make some magic with the result. But unstack hates me. PCSE <- function
2008 Jan 15
4
Overlay plots from different data sets using the Lattice package
#After spending the entire day working on this question, I have decided to reach out for support: #I am trying to overlay a densityplot from one data set over a histogram of another, if I were to plot the two individually, they would look like: # data frame construction data.frame.A <- data.frame(rnorm(12*8), c(rep("one", 4), rep("two", 4), rep("three", 4)),
2012 Jan 17
2
Separate ablines in lattice panels
Searched archives and found some old email threads on the topic. But mot exactly what I think I need. Suppose I have a datafile such as tmp. tmp <- data.frame(var1 = c(rnorm(1000), rnorm(1000, 1, 1)), var2 = gl(2, 1000)) I'd like a plot similar to the one below, but with an abline of v=0 in the lower panel and v=1 in the upper panel. Code below creates two lines in each panel, not quite
2012 Feb 22
1
Lattice and horizontally stacked density plots
Hello, I am try to make a density plot where plots are stacked like the one found here: http://dsarkar.fhcrc.org/lattice/book/images/Figure_14_03_stdBW.png I am facing problems, however. Using the code example below, I'd like to generate a separate panel for each val of id2. Within each panel, I'd like to have individual histograms each on separate lines based on the value of id1. ?Note
2008 May 23
3
Percentages for categorical data by group
I can think of several ways to blunt force hard code what I want but I imagine there is a command or two that can be easily combined to do this: I have a data frame with about 23000 observations. There first variable is the group to which the observation belongs (about 500 different groups). The second variable is a response for each observation that is a 1,2,3,4 or 5. I want to be able to
2009 Mar 23
1
lattice multipanel strip placement - with two factors
Hi, I'm making a multipanel lattice densityplot figure with 2 factors (3 and 20 classes in each factor) with the following statement (the type="percent" is there to prevent plotting the actual points which detract from the figure - is there another way of doing this?): densityplot(~End-Begin | Type * Chromosome, data=Mon, layout=c(5,12), xlab="Element
2006 Jul 07
1
densityplot and panel.groups
I am trying to plot multiple densityplots on each panel, and using panel.groups to do some additional plotting (not included in the example) as in this example. library(lattice) thedata <- data.frame(x=rnorm(1200),class=rep(1:3,each=200,times=2), group=rep(1:2,each=100,times=6)) densityplot(~x | class,groups=group, xlab='x', panel.groups =