daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # x-values
  2. number_aa <-  c(6, 7, 8, 9, 10)
  3. # y1-values
  4. peptide_total <- c(62040, 57755, 50053, 45077, 39011)
  5. # y2-values
  6. peptide_unique <- c(56791, 54978, 47943, 43248, 37658)
  7.  
  8. # determine ymax (from y1-values)
  9. ymax <- peptide_total[which.max(peptide_total)]
  10. ymax
  11.  
  12. # determine xmax (from x-values)
  13. xmax <- number_aa[which.max(number_aa)]
  14. xmax
  15.  
  16. # assign vector of midpoint-values of first barplot (y1) to x
  17. x <- barplot(peptide_total, names.arg = number_aa,
  18.          xlim = c(0, xmax), ylim = c(0, ymax),
  19.          width = 1)
  20.  
  21. # set plotting to overlay (no new plot)
  22. par(new = TRUE)
  23.  
  24. barplot(peptide_unique, col = 'black', names.arg=x,
  25.     xlim = c(0, xmax), ylim = c(0, ymax),
  26.     width = 0.5,
  27.     axisnames = FALSE)
  28.  
  29. # ----> second bar plot is not aligned on first barplot
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top