I'm following this tutorial to plot a stripchart with error bars, but I'm being unable to control bar width.
# Convert the variable dose from a numeric to a factor variable
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
# Plot
ggplot(data = ToothGrowth, aes(x = dose, y = len, color = dose)) +
geom_jitter(position = position_jitter(0.2), size = 2, alpha = 0.3) +
stat_summary(fun.data = mean_se, geom = "pointrange", size = 1.2)
When I add the argument width = 2
, R returns:
Warning message:
In stat_summary(fun.data = mean_se, geom = "pointrange", size = 1.2, :
Ignoring unknown parameters: width
How could I control the width of these error bars?
I think you want linewidth = 2
?
ggplot(data = ToothGrowth, aes(x = dose, y = len, color = dose)) +
geom_jitter(position = position_jitter(0.2), size = 2, alpha = 0.3) +
stat_summary(fun.data = mean_se, geom = "pointrange", size = 1.2, linewidth = 2)