how can I adjust the position errorbars of the bars

how can I adjust the position errorbars of the bars, which all the error bars are shift to the right

type or paste code here
ggplot() + 
  geom_bar(data = mean_se, 
           aes(x = `Tide level`, y = Mean, fill = `Height on tree`),
           stat = "identity", 
           position=position_dodge2()) +
  geom_errorbar(data = mean_se,
                aes(x = `Tide level`, ymin = Mean - se, ymax = Mean + se), width=.2,
                position=position_dodge2())  +
  geom_line(data = mean_se_T,
            aes(x = `Tide level`, y = Mean, group = 1)) +
  geom_point(data = mean_se_T,
             aes(x = `Tide level`, y = Mean)) +
  geom_errorbar(data = mean_se_T,
                aes(x = `Tide level`, ymin = Mean - se, ymax = Mean + se),
                width = 0.2, 
                position = position_dodge(0.05)) +
  labs(x = "Tide level", y = "Average number of snails") +
  theme_classic()

You need a grouping variable, but there isn't one, because you have no aes in the ggplot() call,

ggplot() +
  geom_bar(
    data = mean_se, 
    aes(x = tide_level, y = mean, fill = height_on_tree),
    stat = "identity", 
    position=position_dodge()
    ) +
  geom_errorbar(
    data = mean_se,
    aes(x = tide_level, ymin = mean - se, ymax = mean + se, group = height_on_tree), 
    width = .2,
    position=position_dodge(width=0.90)
    )

This topic was automatically closed 90 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.