R 有没有办法将颜色渐变图例添加到具有对数比例的绘图中?

R 有没有办法将颜色渐变图例添加到具有对数比例的绘图中?,r,plot,legend,R,Plot,Legend,我真的很难给情节添加一个合适的色彩图例。我的图显示了根据对数上升的输入着色的几条线,但是我尝试过的每个解决方案都只显示了一个线性色标 install.packages("plotfunctions") library(plotfunctions) x <- array(data=NA, dim=c(7,100)) param <- 2^(1:7) for (i in 1:7) { x[i,] <- sin(cumsum(rnorm(n = 100,

我真的很难给情节添加一个合适的色彩图例。我的图显示了根据对数上升的输入着色的几条线,但是我尝试过的每个解决方案都只显示了一个线性色标

install.packages("plotfunctions")
library(plotfunctions)

x <- array(data=NA, dim=c(7,100))
param <- 2^(1:7)


for (i in 1:7)
{
  x[i,] <- sin(cumsum(rnorm(n = 100, mean = 0.1, sd = 2/param[i])))
}

mypallette <- wes_palette("FantasticFox1", 7, type = "continuous")

plot(x[1,], type = 'l', col = mypallette[1])
for (i in 2:7)
{
  lines(x[i,], type = 'l', col = mypallette[i])
}

gradientLegend(param, color = mypallette, coords = TRUE, pos = c(0,-1,10,-0.25), n.seg = param)
install.packages(“绘图功能”)
库(绘图功能)
x