Search code examples
plotjuliasurface

Julia Plot Log colorscale


Im trying to build a 3D surface plot with color in log10 scale in julia using plot function. I just want the color to be in the log10 scale NOT the actual values itself.

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))

Below is the output.

enter image description here

Below is the same function that was created using GNUPLOT with logscale in color. How would you create the chart in Julia using plot.

enter image description here


Solution

  • Colors support palettes with logscale=true parameter, for an example:

    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