Bar Chart, ggplot

Hello RCommunity,

I’m trying to make a barplot with an error bar, but it keeps showing this. I have tried with different variables, yet it still shows a lot of error bars.

What does your dataset look like? Can you post your code instead of a screenshot of your code?

Is this what you are trying to do?

Next time post a reproducible example of some data.

library(tidyverse)

# fake data - next time post it so I don't have to do it
df <- tibble(anxiety = runif(50, 0, 100),
               sex = factor(rep(c("male", "female"), 25)),
               fav_col = factor(sample(c("blue", "green", "red"), 50, replace = TRUE))
               )
# anova
data <- Rmisc::summarySE(df, 
                         measurevar =  "anxiety",
                         groupvars = c("sex", "fav_col"))



ggplot(data, aes(sex, anxiety, fill = fav_col)) +
  geom_bar(stat = "identity", 
           position = position_dodge(),
           width = 0.4) +
  geom_errorbar(aes(ymin = anxiety - ci, ymax = anxiety + ci),
                width = 0.4,
                position = position_dodge()) +
  labs(x = "Sex", y = "Anxiety") +
theme_classic()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.