# d <- read.table(pipe('pbpaste'), sep=',') names(d) <- c('y', 'm1', 'd1',
# 'm2', 'd2', 'p')

library(plyr)
library(ggplot2)

d2 <- structure(list(y = 1951:2012, m1 = c(6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
    6L, 6L, 6L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
    6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 5L, 6L, 6L, 
    6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 5L, 6L), d1 = c(15L, 
    14L, 1L, 6L, 13L, 9L, 6L, 11L, 10L, 19L, 9L, 3L, 6L, 9L, 12L, 9L, 22L, 15L, 
    17L, 11L, 3L, 12L, 6L, 11L, 5L, 5L, 7L, 11L, 7L, 8L, 11L, 17L, 12L, 10L, 
    8L, 16L, 9L, 8L, 9L, 1L, 31L, 7L, 30L, 7L, 3L, 8L, 9L, 2L, 17L, 9L, 5L, 
    11L, 10L, 6L, 10L, 9L, 22L, 29L, 3L, 13L, 27L, 9L), m2 = c(7L, 7L, 7L, 7L, 
    7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
    7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
    7L, 7L, NA, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 8L, 7L, 
    7L, 7L, 7L, 7L), d2 = c(18L, 16L, 24L, 25L, 9L, 26L, 28L, 13L, 6L, 18L, 
    8L, 12L, 24L, 22L, 27L, 19L, 18L, 19L, 14L, 20L, 29L, 19L, 5L, 25L, 15L, 
    22L, 21L, 4L, 24L, 21L, 8L, 4L, 26L, 22L, 15L, 27L, 23L, 31L, 19L, 18L, 
    23L, 19L, NA, 12L, 23L, 11L, 19L, 2L, 23L, 16L, 1L, 20L, 2L, 13L, 18L, 30L, 
    1L, 19L, 14L, 17L, 9L, 25L), p = c(121L, 151L, 149L, 135L, 60L, 81L, 131L, 
    99L, 89L, 53L, 127L, 116L, 114L, 81L, 106L, 145L, 88L, 107L, 115L, 113L, 
    74L, 118L, 67L, 139L, 109L, 110L, 97L, 77L, 74L, 96L, 91L, 102L, 105L, 98L, 
    161L, 70L, 78L, 109L, 132L, 51L, 91L, 89L, 147L, 55L, 120L, 96L, 95L, 103L, 
    126L, 124L, 63L, 112L, 85L, 66L, 110L, 120L, 114L, 91L, 95L, 101L, 83L, 
    100L)), .Names = c("y", "m1", "d1", "m2", "d2", "p"), class = "data.frame", 
    row.names = c(NA, -62L))

d3 <- mutate(d2, n1 = as.numeric(as.Date(paste("1900", m1, d1, sep = "/")) - 
    as.Date("1900/4/30")), n2 = as.numeric(as.Date(paste("1900", m2, d2, sep = "/")) - 
    as.Date("1900/4/30")))


m1d <- as.Date(paste0("1900/", 5:9, "/1"))
m1dn <- as.numeric(m1d - as.Date("1900/4/30"))

昭和26年(1951年)以降の梅雨入りと梅雨明け(確定値):関東甲信

http://www.data.jma.go.jp/fcd/yoho/baiu/kako_baiu09.html より。

ggplot(d3, aes(x = n1, xend = n2, y = y, yend = y, colour = p)) + geom_segment(size = 3) + 
    labs(x = "Date", y = "Year", colour = "% amount of rain") + scale_x_continuous(breaks = m1dn, 
    labels = format(m1d, "%b/%e"), limits = range(m1dn)) + theme(legend.position = "bottom")
## Warning: Removed 1 rows containing missing values (geom_segment).

plot of chunk fig

ggplot(d3) + geom_segment(aes(x = n1, xend = n2, y = y, yend = y, colour = p), 
    size = 1) + geom_point(aes(x = n1, y = y)) + geom_path(aes(x = n1, y = y)) + 
    geom_point(aes(x = n2, y = y)) + geom_path(aes(x = n2, y = y)) + geom_point(aes(x = (n1 + 
    n2)/2, y = y), colour = "red") + geom_path(aes(x = (n1 + n2)/2, y = y), 
    colour = "red") + labs(x = "Date", y = "Year", colour = "% amount of rain") + 
    scale_x_continuous(breaks = m1dn, labels = format(m1d, "%b/%e"), limits = range(m1dn)) + 
    theme(legend.position = "bottom")
## Warning: Removed 1 rows containing missing values (geom_segment).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_point).

plot of chunk fig2