0

Ive been trying to plot some data with ggplot2 and it accurately displays the data before facetting, but after facetting - the plot gets all screwed which is visibly apparent in the winter and summer samples. name of the dataframe is Chla. see code and corresponding graphs:

ggplot(Chla,mapping = aes(x=Chla$Bin,y =Chla$`D.O. (mg/L)`, color = Season)) 
+ geom_jitter()

Correct Data

Facet code: ggplot(Chla,mapping = aes(x=Chla$Bin,y =Chla$D.O. (mg/L), color = Season)) + geom_jitter()+facet_grid(Season~.)

Wrong Data

slimj101
  • 13
  • 1
  • Please post your data so we can reproduce your error - [see here for how to do this](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) You shouldn't be referencing your data within `aes`: `aes(x=Bin, y = `D.O. (mg/L)`, color = Season)` – MHammer Jul 05 '18 at 16:05
  • thanks, that solved the issue – slimj101 Jul 05 '18 at 17:14
  • Do you want me to add it as an answer? – MHammer Jul 05 '18 at 17:16
  • Sure why not, it serves as one more reference for anyone who faces the same issue, although silly on my part. – slimj101 Jul 05 '18 at 19:18
  • Ah looks like it's been flagged as a dupe. – MHammer Jul 05 '18 at 19:20

0 Answers0