我在其中使用Julia和PlotlyJS通过在3d图中使用圆锥轨迹来进行一些速度场图。
是否可以通过数字列表(长度= #cones)设置圆锥的大小?
代码:
function plot_av(res::DataFrame, n::Int)
"""
Function to plot the average velocity field
Inputs:
- res:: Dataframe for cells properties
- n:: minimum number of stars in cell
"""
res_full = res[res[:n_star] .> n-1, :]
# Galactic Centre
t0 = scatter3d(; x = [0], y = [0], z = [0], mode = "markers",
marker = attr(color = "#000000",
size = 4, symbol = "cross", opacity = 1),
name = "Galactic Center")
# Average speed;
fields = Dict{Symbol,Any}(:type => "cone",
:x => collect(res_full[:x_cell]),
:y => collect(res_full[:y_cell]),
:z => collect(res_full[:z_cell]),
:u => collect(res_full[:u_mean]),
:v => collect(res_full[:v_mean]),
:w => collect(res_full[:w_mean]),
:sizemode => "absolute",
:sizeref => 100,
:colorscale => "Greens"
)
tvel = GenericTrace("cone", fields)
layout = Layout(autosize=false, width=800, height=800,
margin=attr(l=0, r=0, b=0, t=65))
plot([t0, tvel], layout)
end
我尝试将:sizeref
设置为数组,但是没有用。
答案 0 :(得分:0)
:sizeref由Plotly例程使用,并带有源代码: https://github.com/plotly/plotly.js/blob/master/src/traces/cone/attributes.js
似乎已定义并用作单个数字。因此,这一限制似乎是Plotly内部的限制。因此,我认为PlotlyJS不能在此处使用数组。