Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # x-values
- number_aa <- c(6, 7, 8, 9, 10)
- # y1-values
- peptide_total <- c(62040, 57755, 50053, 45077, 39011)
- # y2-values
- peptide_unique <- c(56791, 54978, 47943, 43248, 37658)
- # determine ymax (from y1-values)
- ymax <- peptide_total[which.max(peptide_total)]
- ymax
- # determine xmax (from x-values)
- xmax <- number_aa[which.max(number_aa)]
- xmax
- # assign vector of midpoint-values of first barplot (y1) to x
- x <- barplot(peptide_total, names.arg = number_aa,
- xlim = c(0, xmax), ylim = c(0, ymax),
- width = 1)
- # set plotting to overlay (no new plot)
- par(new = TRUE)
- barplot(peptide_unique, col = 'black', names.arg=x,
- xlim = c(0, xmax), ylim = c(0, ymax),
- width = 0.5,
- axisnames = FALSE)
- # ----> second bar plot is not aligned on first barplot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement