Kategorien

`require(ggplot2)require(dplyr)f1 <- function(x) {y1 <- 3*sqrt(1-(x/7)^2)y2 <- -3*sqrt(1-(x/7)^2)y <- c(y1,y2)d <- data.frame(x=x,y=y)d <- d[d\$y > -3*sqrt(33)/7,]return(d)}x1 <- c(seq(3, 7, 0.001), seq(-7, -3, 0.001))d1 <- f1(x1)p1 <- ggplot(d1,aes(x,y)) + geom_point(color="green")x2 <- seq(-4,4, 0.001)y2 <- abs(x2/2)-(3*sqrt(33)-7)*x2^2/112-3 + sqrt(1-(abs(abs(x2)-2)-1)^2)#only work with ggplot2 <= 0.8.9#p2 <- p1 + geom_point(aes(x=x2,y=y2), color="yellow")# in ggplot2 0.9.0, should be:d2 <- data.frame(x2=x2, y2=y2)p2 <- p1 + geom_point(data=d2, aes(x=x2,y=y2), color="green")x3 <- c(seq(0.75,1,0.001), seq(-1,-0.75,0.001))y3 <- 9-8*abs(x3)#p3 <- p2+geom_point(aes(x=x3,y=y3), color="green")d3 <- data.frame(x3=x3, y3=y3)p3 <- p2+geom_point(data=d3, aes(x=x3,y=y3), color="green")x4 <- c(seq(0.5,0.75,0.001), seq(-0.75,-0.5,0.001))y4 <- 3*abs(x4)+0.75#p4 <- p3+geom_point(aes(x=x4,y=y4), color="steelblue")d4 <- data.frame(x4=x4,y4=y4)p4 <- p3+geom_line(data=d4, aes(x=x4,y=y4), color="green")x5 <- seq(-0.5,0.5,0.001)y5 <- rep(2.25,length(x5))#p5 <- p4+geom_point(aes(x=x5,y=y5))d5 <- data.frame(x5=x5,y5=y5)p5 <- p4+geom_line(data=d5, aes(x=x5,y=y5),color="green")x6 <- c(seq(-3,-1,0.001), seq(1,3,0.001))y6 <- 6 * sqrt(10)/7 +(1.5 - 0.5 * abs(x6)) * sqrt(abs(abs(x6)-1)/(abs(x6)-1)) -6 * sqrt(10) * sqrt(4-(abs(x6)-1)^2)/14#p6 <- p5+geom_point(aes(x=x6,y=y6), colour="blue")d6 <- data.frame(x6=x6,y6=y6)p6 <- p5+geom_line(data=d6,aes(x=x6,y=y6), colour="green")p <- p6theme_black<- function (base_size = 16, base_family = ""){theme_minimal() %+replace% theme( line = element_line(colour = "black", size = 0.5, linetype = 1, lineend = "butt"), rect = element_rect(fill = "black", colour = "black", size = 0.5, linetype = 1), plot.background = element_rect(colour = 'black', fill = 'black'),plot.title = element_text(size = rel(1.2)),panel.border = element_rect(fill = NA, colour = "black"),axis.title.x=element_blank(),axis.text.x=element_blank(),axis.ticks.x=element_blank(),axis.title.y=element_blank(),axis.text.y=element_blank(),axis.ticks.y=element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank())}p+theme_black()`