I couldn't run cshapes
for some reason, but here's an example of how to build curves using curveGrob()
from the grid
package and ggplot2
's annotation_custom()
function. It gives you a lot of flexibility. PS: most of the params are just defaults. Edit - updated to show 2 curves.
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(), vp = NULL)
myCurve2<-curveGrob(0, 0, 1, 1, default.units = "npc",
curvature = -0.3, angle = 60, ncp = 10, shape = 1,
square = FALSE, squareShape = 1,
inflect = FALSE, arrow = arrow(), open = TRUE,
debug = FALSE,
name = NULL, gp = gpar(), vp = NULL)
g +
annotation_custom(grob=myCurve,0,10,0,10) + # plot from 0,0 to 10,10
annotation_custom(grob=myCurve2,2.5,6,2.5,6) # plot from 2.5,2.5 to 6,6
#REFERENCE>>http://stat.ethz.ch/R-manual/R-devel/library/grid/html/grid.curve.html