add error bars to ggplot for 1d discrete functions