Plotly and Options (or: how to get a surface with a single color)

#1

I am just playing around with plotting – hard to find something handy and well documented. There’s some documentation of plot.ly – but only for Javascript and I can’t figure out how that was ported to be used within Plots.jl

I would like to draw a surface with a single color (not completely opaque but I got that):

using Plots
plotly()
n = 180
u = linspace(0,2*π,n);
v = linspace(0,π,n);
x = cos.(u) * sin.(v)';
y = sin.(u) * sin.(v)';
z = ones(n) * cos.(v)';
surface(x,y,z,opacity=0.5)

And I found nothing how to set the surface color nor how a color is specified; a html string maybe? Is there some comprehensive documentation of all options of surface? I couldn’t find anything, though for example for scatter plots (I would like to impose one afterwards) theres "color" => "rgb(127, 127, 127)"- see https://plot.ly/julia/3d-scatter-plots/ – but how to specify that for a surface? surfacecolor doesn’t seem to exist, surface_color neither, any Dict or String approach also failed.

Any examples/ideas how to set a surface color of say (0,0,0.7) (in [0,1]^3) ?

2 Likes

#2

Just facing the same problem. I hope there are better solutions, but here is my workaround:

using Plots, Colors
plotly()
const_color = cgrad( [ RGB{Float64}(0.5,1,0.5) for _ in 1:2 ] )
surface( x, y, z, color = const_color )
0 Likes