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

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Sun Jul 18 08:17:06 CEST 2021

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.


Rolf Turner

Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

-------------- next part --------------
A non-text attachment was scrubbed...
Name: eg.pdf
Type: application/pdf
Size: 5654 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210718/7726e136/attachment.pdf>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: egData.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210718/7726e136/attachment.txt>

More information about the R-help mailing list