[R] Hmisc Dotplot with confidence intervals and panel.points problem
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Mon Dec 22 15:18:34 CET 2008
PSJ wrote:
> Hello useRs,
> I have a question regarding the function Dotplot from the Hmisc package: I want two things:
> 1) confidence intervals around the dots
> 2) some additional "annotation" points plotted in the graphic
>
> I can easily achieve (1) by constructing an appropriate object with Cbind. But for (2) when I use the panel=function argument the confidence intervals of the original plot are gone.
>
> This is my (simplified) code:
>
> Dotplot(
> resultrow ~ Cbind(ESTIM, L95, U95),
> data=results,
> abline=list(v=0),
> scales=list(
> y=list(
> labels=paste(as.character(foo$bar),
> at=results$nranalysis,
> cex=0.5
> )
> ),
> xlab="some label",
> ylab="",
> xlim=c(-10,10),
> main=paste("a title"),
> subscripts = T,
> panel=function(...)
> { #panel.xYplot(...)
> panel.points(x=rep(9, length(toobig)), y=results$noanalysis[toobig], pch=62)
> panel.dotplot(...)
> }
> )
> I tried a number modifications of this code but without success.
> I'm sure I'm doing something wrong here, but I cannot figure it out... any ideas?
>
> Thanks in advance!
> Peter
Peter,
The panel function must run panel.Dotplot(...) and not panel.dotplot.
Inside panel you can run whatever else you need.
Frank
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Background information:
> =======================
> My problem is that some of the values to be plotted have a big range, so that one cannot see what is happening near zero (which is of more interest for me), because the x-axis is properly scaled by R. So I use xlim to restrict drawing to -10 to 10. But then some points and confidence intervals are no more visible. So I decided to put a character ">" at x-value 9 for the ones lying above 10 and the code above leads to the correct plotting of the original data and markers in the right places but the confidence intervals are gone. I guess that the confidence intervals are themselves plotted by a panel function which in some way gets overwritten by my custom one.
>
>
> System Information:
> ===================
>> sessionInfo()
> R version 2.7.2 (2008-08-25)
> 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 datasets tcltk utils methods
> [8] base
>
> other attached packages:
> [1] svSocket_0.9-5 TinnR_1.0.2 R2HTML_1.59 Hmisc_3.4-4
>
> loaded via a namespace (and not attached):
> [1] cluster_1.11.11 grid_2.7.2 lattice_0.17-17 svMisc_0.9-5
> [5] tools_2.7.2
>
> LOVE at LYCOS ist jetzt ganz neu ? melde dich kostenlos an, lerne neue Leute kennen und finde deinen Flirt! http://love.lycos.de/start.action
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> 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.
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list