79131914

Date: 2024-10-28 02:35:53
Score: 0.5
Natty:
Report link

The question has no dataset, so I use the diamonds to illustrate the solution.

The package superb has a redefined geom called geom_superberrorbar(). It has an argument called pointing which can be "up", "down" or "both" (default).

It is easy to use in conjunction with superb() to compute the means and confidence intervals automatically:

library(superb)
library(ggplot2)

#load diamonds dataset
diamonds <- diamonds

superb( price ~ cut + color, diamonds,
        # send the following arguments to the geom_superberrorbar:
        errorbarParams = list( color="black",pointing = "up")
    ) + 
    ylab("mean price") +
    ggtitle("One-ended Dynamite plot")

You get:

mean plot with error bars pointing up only

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Denis Cousineau