用R作不同国家的国旗

时间:2022-10-28 09:21:14 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

#五星红旗

win.graph(width=5,height=3);plot.new()

par(mar=c(0,0,0,0))

plot.window(xlim = c(0, 1),ylim = c(0,1),

xaxs="i",yaxs="i")

image(matrix(1:1000,10), col = rep('red',100),add=T, axes=F)

symbols(0.2,0.8, stars=as.matrix(t(c(0.1,0.05,0.1,0.05,

0.1,0.05,0.1,0.05,0.1,0.05)/2)),add=T, fg='yellow',bg="yellow", lwd=1, inches=F)

symbols(0.37,0.9, stars=as.matrix(t(c(0.1,0.05,0.1,0.05,

0.1,0.05,0.1,0.05,0.1,0.05)/4)),add=T,fg='yellow', bg="yellow", lwd=1, inches=F)

symbols(0.39,0.75, stars=as.matrix(t(c(0.1,0.05,0.1,0.05,

0.1,0.05,0.1,0.05,0.1,0.05)/4)),add=T, fg='yellow',bg="yellow", lwd=1, inches=F)

symbols(0.35,0.62, stars=as.matrix(t(c(0.1,0.05,0.1,0.05,

0.1,0.05,0.1,0.05,0.1,0.05)/4)),add=T,fg='yellow', bg="yellow", lwd=1, inches=F)

symbols(0.25,0.56, stars=as.matrix(t(c(0.1,0.05,0.1,0.05,

0.1,0.05,0.1,0.05,0.1,0.05)/4)),add=T,fg='yellow', bg="yellow", lwd=1, inches=F)

#美国国旗

win.graph(width=5,height=3);plot.new()

par(mar=c(0,0,0,0))

plot.window(xlim = c(0, 27),ylim = c(0,13),

xaxs="i",yaxs="i")

for(i in seq(1,by=2,length=7))

{

rect(0,i-1,27,i,border=NA,col="red")

}

for(i in seq(2,by=2,length=6))

{

rect(0,i-1,27,i,border=NA,col="white")

}

rect(0,6,11.8,13,,border=NA,col="blue")

b1=c(6.7,6+3*0.7,6+5*0.7,6+7*0.7,6+9*0.7)

b2=c(6+2*0.7,6+4*0.7,6+6*0.7,6+8*0.7)

b=b1

a=rep(1,5)

for(i in 2:11)

{

if((i/2)!=ceiling(i/2))#奇数

{

a=append(a,rep(i,5))

b=append(b,b1)

}

if((i/2)==ceiling(i/2))#偶数

{

a=append(a,rep(i,4))

b=append(b,b2)

}

}

for(j in 1:50)

symbols(a[j],b[j], stars=as.matrix(t(c(0.1,0.05,0.1,0.05,

0.1,0.05,0.1,0.05,0.1,0.05)*4.5)),add=T, bg="white", lwd=1, inches=F)

#加拿大国旗

win.graph(width=5,height=3);plot.new()

par(mar=c(0,0,0,0))

plot.window(xlim = c(-13.5, 13.5),ylim = c(0.6,5.4),

xaxs="i",yaxs="i")

x1=c(0.2,0.1,3.2,3,6.2,5.2,5.8,4,3.4,2,1.7,2.2,1.5,1,0)

y1=c(1,2,1.9,2.2,3,3.3,3.8,3.7,4,3.5,3.5,4.5,4.3,4.3,5)

x2=-rev(x1)

y2=rev(y1)

x=append(x1,x2)

y=append(y1,y2)

polygon(x,y,col="red",border="red")

rect(7.5,.6,13.5,5.4,col="red",border=NA)

rect(-7.5,.6,-13.5,5.4,col="red",border=NA)

本文来源:https://www.wddqw.com/doc/a2a7c31b5a8102d276a22fec.html