服务热线
178 0020 3020
R语言作图第六期任务 –R025
A:
mycol<-c("blue","white","darkgoldenrod1","red")
col=mycol
B
mypalette<-brewer.pal(12,"Set3")#定义画板,brewer.pal()中有大量的定义好的色系可用,但渐变色在3~12之间,不适用于热图绘制
color=mypalette
C: 一些简单的小命令如
rainbow、heat.colors、terrain.colors、topo.colors、cm.colors在grDevices包中
colorpanel(n, low, mid, high), redgreen(n), greenred(n), bluered(n), redblue(n)在gplots中,使用记得加载相应的包
D: color = colorRampPalette(c("blue","white","darkgoldenrod1"))(50)#
###调色板,可用自定义一种,两种,三种或者多种,渐变数可以自定义,包括透明度,推荐使用,但颜色的搭配需要自己填充
a <- c(1:56)##看了一下原数据很简单,就直接写在里面了 e<-rep(11:38,2) b = 5*sin(a) + 20 d = 13*cos(a)-5*cos(2*a)-2*cos(3*a)-cos(6*a)+20 #pdf(test1.pdf") plot(b,ylim = c(10,38),type="l",col = "green", bty = "l",xlab = 'keyangou', cex = 2,ylab = "R", main = "I love keyan",font=2,font.lab=2,lwd=2) points(d, col= "blue") lines(a,e,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()
结果
附件