julia - PlotlyJS 3d 锥体
问题描述
我在其中使用 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
为一个数组,但它不起作用。
解决方案
:sizeref 由 Plotly 例程使用,这里有源代码: https ://github.com/plotly/plotly.js/blob/master/src/traces/cone/attributes.js
这似乎被定义并用作单个数字。所以这个限制似乎是 Plotly 中的一个。所以,我认为 PlotlyJS 不能在这里使用数组。
推荐阅读
- asp.net - asp.net 项目模板按钮 - 禁用,运行代码后面
- javascript - 为什么使用 JS 更改此 CSS 效果仅适用于某些值?
- python - Python Pandas 样式函数在特定条件下突出显示特定列
- go - 如何静态链接外部 Go 库
- git - 错误推送到 master 后将更改推送到不同的分支
- msal - 什么重定向与 MSAL 一起用于 Chrome 扩展?
- javascript - Regular Expression pattern matching equal 0's and 1's
- react-native - react-native init (0.57) 找不到模块'@babel/plugin-external-helpers'
- css - 简单的表单 css html 5
- c++ - 在任务栏图标的右键菜单中更改标题