[R] Plotting confidence intervals with ggplot, in multiple facets.

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Sun Jul 18 14:10:57 CEST 2021


Something like this?


eg <- dget("data/egData.txt")

ggplot(eg, aes(Ndat, estimate)) +
 � geom_errorbar(aes(ymin = lower, ymax = upper), width = 20) +
 � geom_point(colour = "slateblue", size = 1) +
 � geom_hline(yintercept = 0, colour = "red") +
 � facet_grid(param ~ .) +
 � theme_bw()

Hope this helps,

Rui Barradas

�s 07:17 de 18/07/2021, Rolf Turner escreveu:
> I have need of creating a plot displaying confidence intervals
> (for the mean bias in parameter estimates) with one panel or facet
> for each of the two parameters in question.
> I can do this in base R graphics, but the result is not as
> aesthetically pleasing as I would like.  I have attached an example
> graphic in the file "eg.pdf".
> I would like to try using ggplot2, but cannot get my head around the
> syntax.  (Life is a struggle when one is old and senile!)  I have been
> shown in the past how to produce a single-facet plot of such confidence
> intervals, basically using the geom_errorbar() function, but I cannot
> see how to produce multiple facets, depending on a "param" factor.  I
> have thrashed around a bit but after succeeding in only confusing
> myself, I thought I would save wear and tear on my brain by asking this
> list.  I'm sure the answer is pretty simple, but I'm just too stupid to
> see it.
> Can anyone give me a recipe for creating, with ggplot(), a graphic like
> unto that shown in "eg.pdf", but prettier?  I have attached the data
> that were used to create "eg.pdf" in the form of a data frame, in a
> file called "egData.txt".  This file was produced by dput() so read it
> in using dget("egData.txt").
> With eternal gratitude.
> cheers,
> Rolf Turner
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

Este e-mail foi verificado em termos de v�rus pelo software antiv�rus Avast.

	[[alternative HTML version deleted]]

More information about the R-help mailing list