Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想根据z的值给我画的图上色,比如这样
x<-y<-seq(-2*pi, 2*pi, pi/15) f<-function(x,y) sin(x)*sin(y) z<-outer(x,y, f) #contour(x,y,z,col="blue") persp(x,y,z,theta=30, phi=30, expand=0.7,col=heat.colors(25))
如果我想用彩虹色或热色给这张图片上色。颜色z值越大,颜色越深,我该怎么办,如何控制颜色集
谢谢你们
除了帮助中的示例之外,您还可以使用drape.plotfromfields包,默认情况下,它会根据 z 值从颜色条中分配颜色。它调用drape.color后跟 persp,最后将图例条添加到 image.plot。
drape.plot
fields
drape.color
ncol <- 5 library(fields) drape.plot( x,y,z, col=rainbow(nbcol))