服务热线
178 0020 3020
今天先交作业,有些问题,随后再改,老婆要生了,有点忙
col设置颜色的函数:
A:直接写颜色名字,颜色名及颜色见附件1: 颜色.pdf
B:R预设调色板:rainbow、heat.colors、terrain.colors、topo.colors、cm.colors,具体颜色见附件2: 调色板.jpg
C:自定义调色板:colorRampPalette(c(“颜色1”,“颜色2”))(n)
D: 灰度调色板:gray(0:n/n)
2.
x <- read.csv('/Users/taowang/documents/R/6.csv',header = F)
head(x)
a <- x$V1
b <- 5*sin(a) + 20
d <- 13*cos(a)-5*cos(2*a)-2*cos(3*a)-cos(6*a)
pdf(file = "/Users/taowang/documents/R/6-2.pdf")
plot(a, b, type = "l",col = "green", ylim = c(10,38),
bty = "l",xlab = 'keyangou',cex = 2,ylab = "R", main = "I love keyan"
)
points(a, d, col= "blue")
lines(x$V1,x$V2,type = "s",col = "red")
legend("topleft", legend = c("point1","line2","point3"),
col = c("red","green","blue"),
pch = c(NA,NA,1),
lty = c(1,1,NA))
dev.off()
图见附件3: 6-2.pdf
附件