Santosh wrote:
Thanks for your email... yes, I had tried that "bw" thing.. for some
reason it does not seem to work.. could not figure out where I am wrong...
Below is an example for your convenience.. you might notice that the
density plots appear to be a curve of connected segments. Changing
breaks, nint or bw didn't seem to help.
############
library(reshape)
set.seed(13454)
aa <-
data.frame(a1=rnorm(500),b1=rnorm(500,0.8),c1=rnorm(500,0.5),cat1=rep(1:5,each=100))
ab <- melt(aa,measure.vars=c("a1","b1","c1"))
histogram(~
value|variable,ab,breaks=NULL,nint=10,type="density",layout=c(2,2),as.table=T,scales=list(relation='free'),
panel=function(x,lqp=c(0.05,0.975),...) {
panel.histogram(x,col='lightblue',...)
panel.densityplot(x,col.line='blue',lwd=1.75,bw=2,...)
replace bw = 2 by darg = list(bw = 2), then it works for me. Read the
documentation of panel.densityplot carefully, it says that you need to
use darg = list().
cheers,
Paul
panel.abline(v=c(quantile(as.vector(x),prob=lqp,na.rm = T)),
col="dark green",lwd=2,lty=2)
},
strip=strip.custom( strip.names=F,
strip.levels=T,
par.strip.text=list(cex=0.75)),
)
############
Thanks again,
Santosh
On Thu, Apr 15, 2010 at 12:41 AM, Paul Hiemstra <p.hiems...@geo.uu.nl
<mailto:p.hiems...@geo.uu.nl>> wrote:
Santosh wrote:
Dear R gurus...
How do I control "smoothing" of a density plot in
panel.densityplot when
using histogram?
Thanks much,
Santosh
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org <mailto:R-help@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.
Hi,
From ?panel.densityplot, argument darg, I was referred to
?density. I think the 'bw' argument is what you need. Pass it to
panel.densityplot in the darg argument.
cheers,
Paul
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul>
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
______________________________________________
R-help@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.