「finaldata」と呼ばれる次のデータフレームがあります
structure(list(Dates = structure(c(325213200, 325216800, 325220400,
325224000, 325227600, 325231200, 325234800, 325238400, 325242000,
325245600, 325249200, 325252800, 325256400, 325260000, 325263600,
325267200), tzone = "UTC", class = c("POSIXct", "POSIXt")), Qobs = c(0.7679669,
0.7679669, 0.7679669, 0.7679669, 0.7679669, 0.7679669, 0.7679669,
0.7679669, 0.7679669, 0.7679669, 0.7679669, 0.7679669, 0.7679669,
0.7679669, 0.7679669, 0.7679669), LB1 = c(6.856253e-14, 6.856253e-14,
6.856253e-14, 6.856253e-14, 6.856253e-14, 6.856253e-14, 6.856253e-14,
-8.273674e-07, -4.344798e-06, -7.625017e-06, -1.004544e-05, -1.155634e-05,
1.842427e-10, 1.813103e-10, 1.74717e-10, 1.658628e-10), UB1 = c(36.84034,
36.72503, 36.61008, 36.49549, 36.38126, 36.26738, 36.15387, 36.04071,
35.9279, 35.81546, 35.70336, 35.59162, 35.48023, 35.36925, 35.25862,
35.14833), LB2 = c(0.3167181, 0.3142281, 0.3117576, 0.3093065,
0.3068748, 0.3044625, 0.3020694, 0.3076093, 0.3253525, 0.3389268,
0.3457364, 0.3467479, 0.3533797, 0.3724299, 0.3848245, 0.3882089
), UB2 = c(35.31174, 35.17496, 35.03872, 34.903, 34.7678, 34.63314,
34.49901, 34.36992, 34.24928, 34.12819, 34.00447, 33.878, 33.75473,
33.63942, 33.53223, 33.5228)), class = "data.frame", row.names = c(NA,
-16L), .Names = c("Dates", "Qobs", "LB1", "UB1", "LB2", "UB2"
))
次のコードを使用して、1 つの曲線と 2 つの重なり合うリボンを描画しました。
xlabel <- "Time"
ylabel <- "Q"
p <- ggplot(data=finaldata, aes(x = Dates)) +
geom_ribbon(aes(ymin=LB1,ymax=UB1, fill = 'Res1'), alpha = 0.5) +
geom_ribbon(aes(ymin=LB2,ymax=UB2, fill = 'Res2'), alpha = 0.5) +
geom_line(aes(y=Qobs, color=factor(1))) +
xlab(" ") +
scale_y_continuous("Q", lim=c(0,175)) +
scale_fill_manual("", values = c('Res1' = 'mistyrose3', 'Res2' = 'mistyrose'),labels = c(label1,label2)) +
scale_colour_manual(breaks = 1, values = "lightskyblue4", labels = "Obs") +
theme(legend.position=c(0.85,0.85), legend.title = element_blank(), legend.background = element_blank())
その結果が下の図で、最初のリボンに空の垂直バンドが表示されています。
LB1 が負の場合、リボンは描かれていないようです。私は何を間違っていますか?