问题
I am looking for the calculated values of ggplot2 when applying geom_curve
.
Herefore, a little reproducible example:
require(ggplot2)
df <- data.frame(x=c(0,2), y=c(5,5))
plot <- ggplot() +
geom_curve(data = df, aes(x = df[1,"x"], y = df[1,"y"], xend = df[2,"x"], yend = df[2,"y"]),
color = "red", linetype = 3, curvature = 0.4, size = 2)
plot
This plots a red curve between the two points of my data.frame. I am interested in the calculated values for plotting the arc, done by geom_curve
. How can I access them?
I was looking at ggplot_build(plot)
but did not succeed. E.g. in ggplot_build(plot)$layout$finish_data
is function stored but I don't know how to access it.
Or in ggplot_build(plot)$data
are just the definitions of the curved stored but I think the values have to be somewhere in ggplot_build
.
I would like to get all the calulcated points of this geom_curve
or store the applied function in my global environment.
来源:https://stackoverflow.com/questions/45734457/how-to-access-calculated-values-of-geom-curve-in-ggplot2-r