Skip to content

ggplot2 error bars and convex hulls

3 messages · Ivan Calandra, Rui Barradas

#
Dear useRs,

I would like to have horizontal and vertical error bars extending from
the means on two continuous variables.

This would be the "manual" way of doing it, computing the mean and sd
(or whatever stats) beforehand and then calling geom_errorbar() and
geom_errorbarh() with appropriate coordinates:
https://stackoverflow.com/questions/12570816/ggplot-scatter-plot-of-two-groups-with-superimposed-means-with-x-and-y-error-bar

But I am a bit surprised that there is no "built-in" way of doing it
with ggplot2. I mean not having to compute mean and sd beforehand and
not having to call both geom_errorbar() and geom_errorbarh() with a new
set of aesthetics.

In the same idea, I am looking at convex hulls and I was also expecting
to have a built-in way to do this in ggplot2. But I have only found this
"manual" way:
https://stats.stackexchange.com/questions/22805/how-to-draw-neat-polygons-around-scatterplot-regions-in-ggplot2

Thank you in advance for any pointer.
Ivan
#
Hello,

As for convex hulls, there is an example of how to construct a stat_hull in

vignette("extending-ggplot2", package = "ggplot2")

There is also a geom_hull in a GitHub package:

devtools::install_github("cmartin/ggConvexHull")


Hope this helps,

Rui Barradas

?s 17:02 de 21/04/20, Ivan Calandra escreveu:
#
Thanks Rui for these 2 possibilities; I'll have a look.

Any one with pointers for the error bars issue?

Ivan

--
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
+49 (0) 2631 9772-243
https://www.researchgate.net/profile/Ivan_Calandra
On 21/04/2020 19:06, Rui Barradas wrote: