Malte Brockmann
2008-Jun-11 14:12 UTC
[R] Problem with densityplot from the lattice package
Dear list, I just experienced some strange behavior of the densityplots provided by the lattice package. Depending on the values for "from" and "to" that are passed on to the function for kernel density estimates, the densityplot excludes the jittered stripplot that is routinely included in lattice densityplot. Example: library(lattice) test<-runif(100) densityplot(test) #the standard density plot without problems densityplot(test, from=0, to=1) #stripplot is excluded densityplot(test, from=-1, to=2) #stripplot is again included Any hints how I could get the stripplot back in the second example? Tanks in advance Malte> sessionInfo()R version 2.7.0 (2008-04-22) i386-pc-mingw32 locale: LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lattice_0.17-8 loaded via a namespace (and not attached): [1] grid_2.7.0 ____________________________________________________________ sent via xelos.net | the communication and groupware solution
Prof Brian Ripley
2008-Jun-11 14:48 UTC
[R] Problem with densityplot from the lattice package
Look at the y axis ... so try something like densityplot(test, from=0, to=1, ylim=c(-0.1, 1.5)) The jittered plot is plotted centred on y=0. On Wed, 11 Jun 2008, Malte Brockmann wrote:> > Dear list, > > I just experienced some strange behavior of the densityplots provided by the lattice package. Depending on the values for "from" and "to" that are passed on to the function for kernel density estimates, the densityplot excludes the jittered stripplot that is routinely included in lattice densityplot. > > > Example: > > library(lattice) > test<-runif(100) > densityplot(test) #the standard density plot without problems > densityplot(test, from=0, to=1) #stripplot is excluded > densityplot(test, from=-1, to=2) #stripplot is again included > > Any hints how I could get the stripplot back in the second example? > > Tanks in advance > Malte > > > >> sessionInfo() > R version 2.7.0 (2008-04-22) > i386-pc-mingw32 > > locale: > LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] lattice_0.17-8 > > loaded via a namespace (and not attached): > [1] grid_2.7.0 > > > > ____________________________________________________________ > sent via xelos.net | the communication and groupware solution > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595