From 71910c2d70bb28f661b8a75a8acc6117ac05128c Mon Sep 17 00:00:00 2001 From: Adrian Dawid Date: Wed, 12 Aug 2020 23:24:11 +0200 Subject: [PATCH] Add support for arbitrary 3d mesh --- src/backends/plotly.jl | 10 +++++++++- src/recipes.jl | 7 ------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index cef4a14f..6d2eb55a 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -574,11 +574,19 @@ function plotly_series(plt::Plot, series::Series) elseif st == :mesh3d plotattributes_out[:type] = "mesh3d" plotattributes_out[:x], plotattributes_out[:y], plotattributes_out[:z] = x, y, z - plotattributes_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha]) + + if :i in keys(series[:extra_kwargs]) && :j in keys(series[:extra_kwargs]) && :k in keys(series[:extra_kwargs]) + plotattributes_out[:i] = series[:extra_kwargs][:i] + plotattributes_out[:j] = series[:extra_kwargs][:j] + plotattributes_out[:k] = series[:extra_kwargs][:k] + end + + plotattributes_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha]) plotattributes_out[:opacity] = series[:fillalpha] if series[:fill_z] !== nothing plotattributes_out[:surfacecolor] = plotly_surface_data(series, series[:fill_z]) end + plotattributes_out[:showscale] = false else @warn("Plotly: seriestype $st isn't supported.") return KW() diff --git a/src/recipes.jl b/src/recipes.jl index 8accfca9..eb4550db 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1536,10 +1536,3 @@ julia> areaplot(1:3, [1 2 3; 7 8 9; 4 5 6], seriescolor = [:red :green :blue], f end is_3d(::Type{Val{:mesh3d}}) = true -# --------------------------------------------------------------------------- -# mesh 3d - -@recipe function f(::Type{Val{:mesh3d}}, x, y, z) - seriestype := :mesh3d - () -end