How to use one color for a surface?


I am trying to use only one color for a surface, but unfortunately I cannot find any example doing this.

The command to generate the surface is simply:


But I cannot find the inputs to specify one specific color.

Kind regards

Using plotly backend, this works:

using Plots; plotly()
surface(rand(5),rand(5),rand(5,5), color=:red)

NB: note that z is 5x5

I am using the default of Plots, which is Gr. That command does not work there. I found this workaround:

    my_cg = cgrad([:green,:green])
    p_surf = surface(x,y,z,c=my_cg,colorbar=false)

Which produces a surface of uniform color in an annoying fashion by having to specify a custom colorbar.

Kind regards, thanks for your suggestion

1 Like

The GR documentation talks about an “option” argument that looks like it will do what you want. I’d like to use this argument too, but I can’t figure out how to pass it to the backend. It’s not a keyword argument, so extra_kwargs doesn’t work.

GR.jl package functionalities go beyond those of the Plots.jl gr() backend used by OP.
Maybe you could create a separate post.