qoiqpwqr 发表于 2012-6-24 06:16 
第二个
png("2.png")
感谢版主,我和你写的程序类似,我觉得这样比较复杂,所以我才发帖提问。
不知道版主能不能用library(plotrix)下面的draw.circle()命令实现。
我也附上我自己写的比较复杂的程序,以供大家交流学习。
#图1:code
windows(height=4,width=4,points=9)
plot(c(-0.2,1.5),c(-0.2,1.5),type="n",axes=FALSE,xlab="",ylab="")
labels=c("t","T"); at=c(0.6,1); yat=c(0,0)-0.1
arrows(x0=0,y0=0, x1=1.4, y1=0,length=0.08, lwd=2)
text(at,yat,labels)
arrows(x0=0,y0=0, x1=0, y1=1.4,length=0.08, lwd=2)
text(yat,at,labels)
polygon(c(0,1,1,0), c(0,0,1,1))
text(-0.1,-0.1,expression(0))
abline(a=-0.6,b=1, lty=2) # or segments()
text(1.2,0.3,expression(y==x-t),cex=1.2)
abline(a=0.6, b=1, lty=2)
text(0.5,1.4,expression(y==x+t),cex=1.2)
xnew=c(0, 0.6, 1, 1, 0.4, 0, 0)
ynew=c(0, 0, 0.4, 1, 1, 0.6, 0)
polygon(xnew,ynew, col="gray")
text(c(1.4,-0.1),c(-0.1, 1.4), c("x","y"),cex=1.2, font=4)
# 图2:code
x=seq(0,2,length=100)
y1=1+sqrt(1-(x-1)^2)
y2=1-sqrt(1-(x-1)^2)
t=1+seq(0,2,length=100)
s1=1+sqrt(1-(t-2)^2)
s2=1-sqrt(1-(t-2)^2)
x1=x[which(x>=1)]
t1=t[which(t<=2)]
a1=y2[which(x>=1)]
a2=s2[which(t<=2)]
j=which.min(abs(a1-a2))
xnew=c(x1[1:j],t1[(j+1):length(t1)])
ynew1=c(s2[1:j],y2[(100-j+1):100])
ynew2=c(s1[1:j],y1[(100-j+1):100])
windows(height=4,width=4,points=9)
plot(c(-0.3,3.7),c(-0.3,3.7),type="n",axes=FALSE,xlab="",ylab="")
polygon(c(-0.2,3.5,rev(c(-0.2,3.5))), c(-0.2,-0.2,rev(c(3,3))), col=3, border = 3)
text(3.1,2.8,expression(Omega),col=1)
polygon(c(x,rev(x)), c(y1,rev(y2)), col=2, border = 2)
polygon(c(t,rev(t)), c(s1,rev(s2)), col=4, border = 4)
polygon(c(xnew, rev(xnew)), c(ynew1,rev(ynew2)),col=7, border=7)
arrows(x0=0.6,y0=1.2,x1=0.95,y1=2.5,col=2,length=0.08)
text(1,2.7,expression(A),col=2)
arrows(x0=2.5,y0=1.1,x1=2.5,y1=2.5,col=4,length=0.08)
text(2.5,2.7,expression(B),col=4)
arrows(xnew[j],ynew2[j],xnew[j]+0.1,2.5,col=7, length=0.08)
text(xnew[j]+0.1,2.7, expression(AB),col=7)