Change i,j,k to series keyword
This commit is contained in:
parent
13353f1637
commit
e594e22c68
@ -288,6 +288,7 @@ const _series_defaults = KW(
|
||||
# one logical series to be broken up (path and markers, for example)
|
||||
:hover => nothing, # text to display when hovering over the data points
|
||||
:stride => (1,1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride.
|
||||
:connections => nothing, # tuple of arrays to specifiy connectivity of a 3d mesh
|
||||
:extra_kwargs => Dict()
|
||||
)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
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]
|
||||
|
||||
if series[:connections] != nothing
|
||||
if typeof(series[:connections]) <: Tuple{Array,Array,Array}
|
||||
i,j,k = series[:connections]
|
||||
if length(i) == length(j) == length(k)
|
||||
throw(ArgumentError("Argument connections must consist of equally sized arrays."))
|
||||
end
|
||||
plotattributes_out[:i] = i
|
||||
plotattributes_out[:j] = j
|
||||
plotattributes_out[:k] = k
|
||||
else
|
||||
throw(ArgumentError("Argument connections has to be a tuple of three arrays."))
|
||||
end
|
||||
end
|
||||
|
||||
plotattributes_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
|
||||
|
||||
@ -331,8 +331,7 @@ function _override_seriestype_check(plotattributes::AKW, st::Symbol)
|
||||
if !RecipesPipeline.is3d(st) && !(st in (:contour, :contour3d))
|
||||
z = plotattributes[:z]
|
||||
if !isa(z, Nothing) &&
|
||||
(size(plotattributes[:x]) == size(plotattributes[:y]) == size(z)) &&
|
||||
st !== :mesh3d
|
||||
(size(plotattributes[:x]) == size(plotattributes[:y]) == size(z))
|
||||
st = (st == :scatter ? :scatter3d : :path3d)
|
||||
plotattributes[:seriestype] = st
|
||||
end
|
||||
|
||||
@ -1547,4 +1547,3 @@ julia> areaplot(1:3, [1 2 3; 7 8 9; 4 5 6], seriescolor = [:red :green :blue], f
|
||||
end
|
||||
end
|
||||
|
||||
is_3d(::Type{Val{:mesh3d}}) = true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user