Skip to content

Add missing 3D charts and related layout options - #125

Merged
kMutagene merged 21 commits into
devfrom
3D
Aug 23, 2021
Merged

Add missing 3D charts and related layout options#125
kMutagene merged 21 commits into
devfrom
3D

Conversation

@kMutagene

@kMutagenekMutagene commented Aug 14, 2021

Copy link
Copy Markdown
Collaborator

This PR adds the 4 missing 3D charts, related Trace objects and layout objects such as the Scene (or adding full support, some are partially there already)

  • Add missing params:
    • Scatter3d
    • Surface
    • Mesh3d
  • Chart.Point3d (based on existing Scatter3d)
  • Chart.Line3d (based on existing Scatter3d)
  • Chart.Spline3d (based on existing Scatter3d)(seems not to be possible: Interpolation for 3d data in plotly plotly.py#423)
  • Chart.Bubble3d (based on existing Scatter3d)
  • Chart.Cone
  • Chart.StreamTube
  • Chart.Volume
  • Chart.IsoSurface
  • Full Scene param support
  • Chart.withScene to set a 3D scene
  • Full ColorAxis support
  • Full ColorBar support
  • Rework of SubplotID to cover all types of subplots
  • Tests
  • Docs

closes#126
closes#127
closes#128
closes#129
closes#130
closes#131

@kMutagene

Copy link
Copy Markdown
CollaboratorAuthor

A few charts as a preview:

  • Cone:
Chart.Cone(
x =[1;1;1],
y =[1;2;3],
z =[1;1;1],
u =[1;2;3],
v =[1;1;2],
w =[4;4;1])

image

  • StreamTube:
lettubeData=
Http.RequestString @"https://raw.githubusercontent.com/plotly/datasets/master/streamtube-wind.csv"|> Frame.ReadCsvString
Chart.StreamTube(
x =(tubeData.["x"]|> Series.values),
y =(tubeData.["y"]|> Series.values),
z =(tubeData.["z"]|> Series.values),
u =(tubeData.["u"]|> Series.values),
v =(tubeData.["v"]|> Series.values),
w =(tubeData.["w"]|> Series.values),
Starts = StreamTubeStarts.init(
X = Array.init 16(fun _ ->80),
Y =[20;30;40;50;20;30;40;50;20;30;40;50;20;30;40;50],
Z =[0;0;0;0;5;5;5;5;10;10;10;10;15;15;15;15]),
ColorScale = StyleParam.Colorscale.Viridis
)

image

  • Volume:
letlinspace(min,max,n)=if n <=2then failwithf "n needs to be larger then 2"letbw= float (max - min)/(float n -1.)
Array.init n (fun i -> min +(bw * float i))letmgrid(min,max,n)=letdata= linspace(min,max,n)letz=[|for i in1.. n do[|for i in1.. n doyield data|]|]letx=[|for i in1.. n do[|for j in1.. n doyield[|for k in1.. n doyield data.[i-1]|]|]|]lety=[|for i in1.. n do[|for j in1.. n doyield[|for k in1.. n doyield data.[j-1]|]|]|]
x,y,z
letx,y,z = mgrid(-8.,8.,40)|>fun(x,y,z)->(x |> Array.concat |> Array.concat),(y |> Array.concat |> Array.concat),(z |> Array.concat |> Array.concat)letvalues= Array.map3 (fun x y z ->
sin(x*y*z)/(x*y*z)) x y z
Chart.Volume(
x, y, z, values,
Opacity=0.1,
Surface=(Surface.init(Count=17)),
IsoMin=0.1,
IsoMax=0.8,
ColorScale = StyleParam.Colorscale.Viridis
)

image

  • IsoSurface:
letxIso,yIso,zIso = mgrid(-5.,5.,40)|>fun(x,y,z)->(x |> Array.concat |> Array.concat),(y |> Array.concat |> Array.concat),(z |> Array.concat |> Array.concat)letvalueIso=
Array.map3 (fun x y z ->
x * x *0.5+ y * y + z * z *2.) xIso yIso zIso
Chart.IsoSurface(
xIso,yIso,zIso,valueIso,
IsoMin =10.,
IsoMax =40.,
Caps = Caps.init(
X =(CapFill.init(Show=false)),
Y =(CapFill.init(Show=false))),
Surface = Surface.init(Count=5),
ColorScale = StyleParam.Colorscale.Viridis
)

image

@kMutagenekMutagene added this to the 2.0 milestone Aug 20, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3D Scene Isosurface Volume Streamtube Cone (reference)

1 participant

@kMutagene