Julia Plot Log色标

问题描述

我正在尝试使用julia函数plot中以log10比例的颜色构建3D表面图。我只希望颜色在log10刻度上而不是实际值本身。

using Plots
N = 51
x = range(-10,stop = 10,length = N)
y = x
f(x,y)=x^2+y^2
Plots.plot(x,y,f,st=:surface,color=:jet,camera=(25,65))

下面是输出

enter image description here

以下是使用GNUPLOT创建的功能,其颜色为对数刻度。您将如何使用图在Julia中创建图表。

enter image description here

解决方法

Colors支持带有logscale=true参数的调色板,例如:

using Colors

Plots.plot(x,y,f,st=:surface,color=Colors.diverging_palette(20,300,20,logscale=true,wcolor=colorant"red",dcolor1=colorant"green",dcolor2=colorant"red",b=0.1,d1=1.0,d2=1.0),camera=(25,65))

enter image description here