0

I am not a coding person at all so I apologize if this looks very wrong, but I'm trying to use R to make a graph. I have all my plots from my data set fine, and I'm trying to make error bars -- but, my data set doesn't exactly match up with what I want so I'm trying to add them manually. I was going to add a data point for each mean, and then use that specific point to put an error bar, but because my x axis values are the same it's adding the point in each column. I put pictures below to better understand what I'm saying.

ggplot(well_data4, aes(x = E2F4, y = Colonies, color = Clone, fill = E2F4)) +
  geom_point(aes(color = Clone), size = 2) +
  geom_point(aes(x=("-/-"), y=2837.3333, color = "black")) +
  labs(title = "HT29 Colony Survival",
       x = "Concentration of SN-38 (nM)",
       y = "Number of colonies") + scale_color_manual(values = c('11' = "darkturquoise", "7" =     "darkturquoise", "2" = "darkturquoise","Control"= "darkorchid")) +
 scale_fill_discrete(labels = c("-/- = E2F4 Knockout", "+/+ = E2F4 Wild Type")) +
 guides(color = guide_legend(override.aes = list(size=3)), fill = guide_legend(override.aes =list(size=2))) +
facet_wrap(~Well, nrow = 1, strip.position = "bottom") +
theme_minimal() + 
theme(strip.placement = "outside", panel.spacing = unit(0, "cm"),  
    strip.text = element_text(size = 10, margin = margin(b=15)),  
    legend.title = element_text(size = 10),
    plot.title = element_text(margin = margin(b=10)))

enter image description here enter image description here

Can anyone help me figure out what to do? Thanks so much

I tried to add this line : geom_point(aes(x=("-/-"), y=2837.3333, color = "black")

and i tried to specify I only wanted it on the "0" x axis column but it was always invalid

astaf
  • 15
  • 3
  • Welcome to SO! Try with putting the data for your points in a dataframe where you also add a column containing the `Well` or facet panel where you want to draw your points, e.g. `dat <- data.frame(x = "-/-", y = 2837.3333, Well = 0)`. Then pass this dataset to `geom_point`, i.e. do `geom_point(data = dat, aes(x = x, y = y), color = "black", inherit.aes = FALSE)`. – stefan Aug 17 '23 at 18:29
  • 2
    For more help please provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of your data or some fake data. – stefan Aug 17 '23 at 18:29
  • 1
    Hi thank you! Okay I tried what you said but it said "Ignoring unknown aesthetics: inherit.aes" . I'm trying to make the reproducible ex. but I'm really confused I'm sorry --- wait no you were right! I had my parentheses in the wrong place. thank you so much! – astaf Aug 17 '23 at 20:08
  • fyi, `inherit.aes` does not go inside `aes(..)`, in case that's how you got that error. (It does work with `geom_point`.) – r2evans Aug 18 '23 at 18:59

0 Answers0