as.data.frame.curve | R Documentation |
Method function to convert an object inheriting from class "curve"
to a data.frame
## S3 method for class 'curve' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
An object inheriting from class |
row.names, optional, ... |
as for |
A data frame object
library(ggplot2) set.seed(1234) z <- complex(real = runif(5), imaginary = runif(5)) z <- z[order(Arg(z - mean(z)))] cz <- closed_curve(z) oz <- open_curve(z) ggplot() + geom_path(data = as.data.frame(cz), aes(x,y), colour = "#DF536B") + geom_path(data = as.data.frame(oz), aes(x,y), colour = "#2297E6") + geom_point(data = as.data.frame(z), aes(x = Re(z), y = Im(z))) + geom_segment(data = as.data.frame(z), aes(x = Re(mean(z)), y = Im(mean(z)), xend = Re(z), yend = Im(z)), arrow = arrow(angle=15, length=unit(0.125, "inches")), colour = alpha("grey", 1/2)) + theme_bw()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.