89_*_*ple 5 plot r colors color-palette
我想生成从浅色调到深色调的不同色调
colfunc <- colorRampPalette(c("green", "red"))
colfunc(10)
plot(rep(1,10),col=colfunc(10),pch=19,cex=3)
Run Code Online (Sandbox Code Playgroud)
如果我尝试为单一颜色运行它
colfunc <- colorRampPalette("green")
colfunc(10)
[1] "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
[7] "#00FF00" "#00FF00" "#00FF00" "#00FF00"
Run Code Online (Sandbox Code Playgroud)
它返回给我相同的值。我怎样才能生成一种颜色的不同色调,比如从浅绿色到深绿色?
fc <- colorRampPalette(c("green", "darkgreen"))
plot(rep(1, 10),col = fc(10), pch = 19, cex = 3)
Run Code Online (Sandbox Code Playgroud)
这是你需要的吗?