Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = read.table(text = "
- start end av y1 y2 y3
- 719000 721000 720000 1 1 2
- 1199000 1201000 1200000 1 1 2
- 3039000 3041000 3040000 1 1 2
- 3679000 3681000 3680000 1 1 2
- 4119000 4121000 4120000 1 1 2
- 4999000 5001000 5000000 1 1 2", sep = " ", stringsAsFactors = F, header = T)
- ids <- factor(paste(1:nrow(data), 1:nrow(data), sep = "."))
- positions <- data.frame(
- id = rep(ids, times = nrow(data)/2),
- x = c(data$start, data$end, data$av),
- y = c(data$y1, data$y2, data$y3)
- )
- values <- data.frame(
- id = ids,
- value = 1:length(ids)
- )
- datapoly <- merge(values, positions, by = c("id"))
- ggplot(datapoly, aes(x = x, y = y)) + geom_polygon(aes(fill = value, group = id))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement