Error bars are not in the hidden

library(ggplot2)
library(tidyverse)
library(dplyr)
library(stringr)
fluor_data <- Kopie_van_Overzicht_Fluoride_11202_

Kopie_van_Overzicht_Fluoride_11202_

df<- as.data.frame(Kopie_van_Overzicht_Fluoride_11202_)

colnames (Kopie_van_Overzicht_Fluoride_11202_) <-c("Sample", "Recovery", "Standard_deviation", "Technique")

ggplot( data = df, aes( x = Sample, y = Recovery) ) +
geom_col( aes( fill = Technique), position = position_dodge(1)) +
labs(title = "Fluorine results", x = "sample", y = "Recovery", fill= "Technique")+
geom_errorbar(aes( x= Sample,ymin = Recovery - Standard_deviation, ymax = Recovery + Standard_deviation),width=0.25, size= 1,alpha=0.9, position = position_dodge(5))

How can this?

I think your position_dodge() value is much too large in geom_errorbar() .Here is an example.

library(ggplot2)
Df <- data.frame(Sample = c("A", "A", "B", "B"),
                 Tech = c("C", "S", "C", "S"),
                 Recovery = c(80, 70, 85, 65),
                 SD = c(10, 9, 7, 11))
ggplot(Df, aes(Sample, Recovery, fill = Tech)) + geom_col(position = position_dodge()) +
  geom_errorbar(aes(ymin = Recovery - SD, ymax = Recovery + SD), 
                width = 0.2, position = position_dodge(0.85))

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.