2019-12-12 10:14:40 +00:00
|
|
|
install.packages("ggplot2")
|
|
|
|
library(ggplot2)
|
|
|
|
|
2019-12-12 10:27:19 +00:00
|
|
|
circle = function(t){
|
2019-12-12 10:14:40 +00:00
|
|
|
x = sin(t)
|
|
|
|
y = cos(t)
|
|
|
|
return(c(x,y))
|
|
|
|
}
|
|
|
|
|
|
|
|
d = list()
|
|
|
|
d$x = c()
|
|
|
|
d$y = c()
|
|
|
|
for(t in c(1:2000)){
|
2019-12-12 10:27:19 +00:00
|
|
|
p_circle = circle(t)
|
|
|
|
d$x=c(d$x,p_circle[1])
|
|
|
|
d$y=c(d$y, p_circle[2])
|
2019-12-12 10:14:40 +00:00
|
|
|
}
|
|
|
|
d= as.data.frame(d)
|
2019-12-12 10:19:45 +00:00
|
|
|
|
2019-12-12 10:14:40 +00:00
|
|
|
blank = theme_void() + theme(legend.position="none")
|
|
|
|
ggplot(data = d)+
|
|
|
|
geom_point(aes(x=x, y=y), size = 0.0001)+
|
|
|
|
blank
|
|
|
|
|
2019-12-12 18:33:00 +00:00
|
|
|
p <- ggplot(data = data.frame(x = 0), mapping = aes(x = x))
|
|
|
|
|
|
|
|
p + stat_function(fun = sun) + xlim(-5,5)
|
|
|
|
|
2019-12-12 10:14:40 +00:00
|
|
|
ggsave("temp.png", width = 30, height = 30, units = "cm")
|
|
|
|
|