我正在处理与
类似的问题Plot curved lines between two locations in ggplot2
简而言之,我想从点(5,5)到(10,0)绘制一条向下倾斜的曲线,但是从(5,0)到(10,5)继续得到一条曲线。
require(grid)
g<-qplot(c(0,10),c(0,10))
myCurve<-curveGrob(0, 0, 1, 1, default.units = "npc",
curvature = 0.3, angle = 90, ncp = 20, shape = 1,
square = FALSE, squareShape = 1,
inflect = FALSE, arrow = arrow(), open = TRUE,
debug = FALSE,
name = NULL, gp = gpar(col="blue", lwd=5), vp = NULL)
myCurve2<-curveGrob(0, 0, 1, 1, default.units = "npc",
curvature = 0.3, angle = 90, ncp = 20, shape = 1,
square = FALSE, squareShape = 1,
inflect = FALSE, arrow = arrow(), open = TRUE,
debug = FALSE,
name = NULL, gp = gpar(col="red", lwd=5), vp = NULL)
g +
annotation_custom(grob=myCurve,0,10,0,10) + # plot from 0,0 to 10,10
annotation_custom(grob=myCurve2,5,10,5,0) # expected a red curve from (5,5) to (10,0)
# but draws from (5,0) to (10,0).
我该如何解决? curveGrob 中参数的任何变化?