1

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?

0

1 Answer 1

1

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)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.