Adding errorbars to line graph with more than one dataset from excel

Hi, I would like to add error bars to demonstrate the standard deviation of the data in my two datasets in one plot.

Please see current code below:

ggplot() +
  geom_path(TPL_c1_Biomarker_data_compiled, mapping = aes(x = Avg_d13C_n, y = depth_m, xmin = Avg_d13C_n-Stdev_avg, xmax = Avg_d13C_n+Stdev_avg, color = "d13Cc1")) +
  geom_point(TPL_c1_Biomarker_data_compiled, mapping = aes(x = Avg_d13C_n, y = depth_m, xmin = Avg_d13C_n-Stdev_avg, xmax = Avg_d13C_n+Stdev_avg, color = "d13Cc1")) +
  geom_path(TPL_c2_Biomarker_data_compiled, mapping = aes(x = Avg_d13C_n, y = depth_m, xmin = Avg_d13C_n-Stdev_avg, xmax = Avg_d13C_n+Stdev_avg, color = "d13Cc2")) +
  geom_point(TPL_c2_Biomarker_data_compiled, mapping = aes(x = Avg_d13C_n, y = depth_m, xmin = Avg_d13C_n-Stdev_avg, xmax = Avg_d13C_n+Stdev_avg, color = "d13Cc2")) +
  scale_y_reverse(breaks = c(0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7)) + 
  geom_errorbarh() +
  xlab("n-alkane d13C column 1 & column 2") +
  ylab("Depth (m)") +
  theme_classic() +
  scale_color_manual("",
                     breaks = c("d13Cc1", "d13Cc2"),
                     values = c("d13Cc1" = "purple", "d13Cc2" = "green"))

Welcome to the forum.

We need a FAQ: How to do a minimal reproducible example ( reprex ) for beginners.

Currently we do not have any data or any idea if you are getting any error messages or if it a more basic problem.

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