similar to: Adding mean line to a lattice density plot

Displaying 20 results from an estimated 2000 matches similar to: "Adding mean line to a lattice density plot"

2008 May 06
2
Lattice problems / cannot load lattice
Hi, My problem is simple: since having updated the lattice package, I cannot load lattice anymore. If I type in the command 'library(lattice)' the loading fails with the following message: --- cut here --- Error in library.dynam(lib, package, package.lib) : shared library 'lattice' not found In addition: Warning messages: 1: In loadNamespace(package, c(which.lib.loc,
2008 Mar 10
2
Multiple density plots
Hi all, I'm interested in doing a multiple density plot on a number of columns in a dataframe. >DF lineA.1 lineA.2 lineB.1 lineB.2 r1 5.355354 6.665575 10.288498 11.74750 r2 3.643415 5.427600 11.407112 13.97065 r3 5.813674 6.438502 9.628871 11.57456 r4 5.241340 5.125049 10.456221 12.35381 r5 4.640885 8.635518 8.344704 11.98484 r6 4.559852 6.416171 10.419599 10.89247 r7
2008 Jun 26
2
density and jpeg
Dear R community, I am using densityplot (lattice package) for a large dataset and wish to print it to a jpeg (the pdf is huge). R crashes consistently. Am I doing it wrong or is densityplot incompatible with jpeg? I work on a Mac, R 2.7.0. > require(lattice) > jpeg("test.jpeg") > d[1:10] [1] 0.700218 0.700175 0.700357 0.700847 0.698286 0.701520 0.698158 0.699300 0.698819
2006 Oct 25
1
density plot text
Is there any way of adding text to a density plot? I have had a go using the text() function but I think the error is because this function doesn't work with densityplot(). Alternatively, I understand I can achieve pretty much the same result if I plot a density kernel estimate using plot() (which allows text()), but I do prefer densityplot(). Also, is it possible to specify the dimensions
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)
2010 Dec 21
1
Density plot with lattice?
Hi, Is it possible to remove the points at the base of a density plot?I would like to keep only the curves of the plot, not the points. Thank you. Marie-Helene HacheyM.Sc. studentUniversite Laval, Quebec
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
2010 Apr 22
2
How to insert gridlines in lattice density plot
Greetings. How can I insert gridlines in the following density plot call? Must one compose a panel function? 'data.frame': 46 obs. of 2 variables: $ fallrates: num 5.2 7.1 7.1 9.8 3.7 7.5 5 6.2 1.5 2.9 ... $ prepost : Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ... library(lattice) densityplot(~fallrates, groups = prepost,
2009 Apr 10
2
Stacked density plots
Hello R-community, I want to generate stacked density plots in lattice. My data consist of a numeric variable ('pid') that is measured in different individuals ('id'), which can be divided in two types ('type') and the measurements were repeated a different time points ('day'). I read in the Lattice book that this can be done using the 'flowViz'
2010 May 11
1
kernel density to smooth plots
Hi r-sers, I have a data of relative frequencies for the interval of 0-20, 20-40,...380-400.  I would like the two data on the same graph using the same x-axis label.  My question is how to get a smooth curve using kernel density code if it possible for this data.   > cbind(rel_obs,rel_gen)           rel_obs rel_gen  [1,] 0.000000000  0.0000  [2,] 0.092534175  0.0712  [3,] 0.105152471  0.1092
2012 Aug 03
2
Density plots
Dear group, I need help on two problems: 1. I am trying to plot density plots for each individual in 8 occasions. I can do this by subject wiht the code below: par(mfrow=c(4,2)) plot(density(all8scenarios$SIMCONC[all8scenarios$ID==1&all8scenarios$WSEQ==0])) plot(density(all8scenarios$SIMCONC[all8scenarios$ID==1&all8scenarios$WSEQ==1]))
2006 Jan 17
2
Cumulative Density Plots (Hmisc/lattice)
I have been using the ECDF function in the Hmisc package to produce cumulative distribution function plots. The problem is that for small datasets the steps "look bad" (not my characterization but from the client). Is there a way to get the same information but smoothed? I have tried the densityplot (lattice), which gives a smoothed line, but this does not give the cumulative density.
2012 Jan 04
1
Adding a vertical line to plot with two overlapping density plots
Hi, A simple question I hope. I wish to add a single vertical line to a plot with several density plots. Here is a simplified example. ############ thedata <- data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data thedata.m<-melt(thedata) densityplot(~value, thedata.m, groups=variable,auto.key=list(columns=2)) #this gives the two density plots ######### what I wish now is to add a
2010 Dec 09
1
Condional Density Plot from different data
I'm not certain I am using the lattice plot correctly here. Below is reproducible code. Suppose I have two data frames, such as: set.seed(1234) datA <- data.frame(condition = gl(3, 100), scores = c(rnorm(100), rnorm(100, 1,1), rnorm(100, 2,1))) datB <- data.frame(condition = gl(3, 1000), scores = c(rnorm(1000, 3,1), rnorm(1000, 4,1), rnorm(1000, 5,1))) I would like to plot the
2011 Mar 20
3
Part of a density plot
Suupose I have y <- rbeta(10000, 2, 5) and I only want to see only the density plot from x = 0 to x = 1 How do I do this? -- Thanks, Jim. [[alternative HTML version deleted]]
2011 Jul 18
1
plotting groups via density and different colors
I have a data set that looks like this: dene <- data.frame(length = c(35,32,33,34,41,40,46,35,41,40,45,36,38,37,39,40,42,42,42,43,44), sex=c(1,1,1,1,2,2,2,1,2,2,2,1,2,2,2,2,2,2,2,2,2)) I would like to plot the density (frequency of occurrence) of each length class but I want to have different colors for sex. I used the following: library(sm) sex.f<-factor(as.factor(dene$sex),levels=c(1,2),
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
2005 Nov 03
3
newbie graphics question: Two density plots in same frame ?
I swear I've scoured the help files and several texts before posting what feels like a dumb newbie question. How can I draw two kernel density plots in the same frame ? I have similar variables in two separate data frames, and I would like to show their two histograms/densities in a single picture. Same units, scale, range for both, so I'm simply trying to draw one and then add the
2012 Jun 19
1
Scaling a "density".
Folks, I have a small dataset of counts of recoveries on defaulted loans: recoveries<-structure(c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 0, 0, 0, 0, 0, 4, 0, 1, 2, 2, 12), .Dim = c(11L, 2L), .Dimnames = list( NULL, c("pcts", "counts"))) Here is the data in columnar form: pcts counts [1,] 0.0 0 [2,] 0.1 0 [3,] 0.2 0 [4,] 0.3
2006 Aug 23
5
two density curves in one plot?
Hello, I was wondering if I can plot two curves I get from "density(data)" into one plot. I want to compare both. With the following commad, I just get one curve plotted: plot( density(mydata) ) Sorry for this stupid question but I could not find a solution until now... Antje