You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to draw a number of spheres at different locations in the same figure, each as a trace. Here is my code:
using PlotlyJS
functionsphere(sphere_number::Int64)
trace = []
for i =1:sphere_number
d =rand(1:50)
n =100
θ =range(0.0, 2*π, length = n)
ϕ =range(0.0, π, length = n)
a = d .+cos.(θ)*sin.(ϕ)'
b = d .+sin.(θ)*sin.(ϕ)'
c = d .+ones(n)*cos.(ϕ)'push!(trace,surface(x = a, y = b, z = c, colorscale="Greys"))
end
layout =Layout(title="Sphere", autosize=false, width=400,
height=400, margin=attr(l=65, r=50, b=65, t=90))
plot(trace, layout)
end
Error:
ERROR: MethodError: no method matching Plot(::Array{Any,1}, ::Layout{Dict{Symbol,Any}})
Closest candidates are:Plot(::Array{TT,1}, ::PlotlyBase.AbstractLayout, ::Base.UUID, ::Style) where TT<:AbstractTrace at C:\Users\zenan\.julia\packages\PlotlyBase\80KwD\src\PlotlyBase.jl:33Plot(::AbstractArray{T,1}, ::Any; style) where T<:AbstractTrace at C:\Users\zenan\.julia\packages\PlotlyBase\80KwD\src\PlotlyBase.jl:58Plot(::AbstractArray{T,N}where N, ::Layout; kwargs...) where T<:Union{Dates.Date, Dates.DateTime, AbstractString, Number, Symbol} at C:\Users\zenan\.julia\packages\PlotlyBase\80KwD\src\convenience_api.jl:61...
Stacktrace:
[1] plot(::Array{Any,1}, ::Vararg{Any,N}where N; options::Dict{Any,Any}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at
C:\Users\zenan\.julia\packages\PlotlyJS\AhkM5\src\display.jl:145
[2] plot(::Array{Any,1}, ::Vararg{Any,N}where N) at C:\Users\zenan\.julia\packages\PlotlyJS\AhkM5\src\display.jl:145
[3] sphere(::Int64) at e:\GitHub\TEMP.jl:19
[4] top-level scope at REPL[38]:1
[5] eval(::Module, ::Any) at .\boot.jl:331
[6] eval_user_input(::Any, ::REPL.REPLBackend) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\REPL\src\REPL.jl:86
[7] run_backend(::REPL.REPLBackend) at C:\Users\zenan\.julia\packages\Revise\MgvIv\src\Revise.jl:1023
[8] top-level scope at none:0
[9] eval(::Module, ::Any) at .\boot.jl:331
[10] eval_user_input(::Any, ::REPL.REPLBackend) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\REPL\src\REPL.jl:86
[11] run_backend(::REPL.REPLBackend) at C:\Users\zenan\.julia\packages\Revise\MgvIv\src\Revise.jl:1023
[12] top-level scope at none:0
I did this because I noticed the way plot([trace1,trace2], layout) was used in the doc.
How can I solve this problem?😅
The text was updated successfully, but these errors were encountered:
I want to draw a number of spheres at different locations in the same figure, each as a
trace
. Here is my code:Error:
I did this because I noticed the way
plot([trace1,trace2], layout)
was used in the doc.How can I solve this problem?😅
The text was updated successfully, but these errors were encountered: