-
Notifications
You must be signed in to change notification settings - Fork 99
Add missing 3D charts and related layout options #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I dont know how this happened but well
A few charts as a preview:
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]
)
let tubeData =
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
)
let linspace (min,max,n) =
if n <= 2 then failwithf "n needs to be larger then 2"
let bw = float (max - min) / (float n - 1.)
Array.init n (fun i -> min + (bw * float i))
let mgrid (min,max,n) =
let data = linspace(min,max,n)
let z = [|for i in 1 .. n do [|for i in 1 .. n do yield data|]|]
let x = [|for i in 1 .. n do [|for j in 1 .. n do yield [|for k in 1 .. n do yield data.[i-1]|]|]|]
let y = [|for i in 1 .. n do [|for j in 1 .. n do yield [|for k in 1 .. n do yield data.[j-1]|]|]|]
x,y,z
let x,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)
let values =
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
)
let xIso,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)
let valueIso =
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
) |
This was referenced Aug 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)Chart.Point3d
(based on existing Scatter3d)Chart.Line3d
(based on existing Scatter3d)(seems not to be possible: Interpolation for 3d data in plotly plotly.py#423)Chart.Spline3d
(based on existing Scatter3d)Chart.Bubble3d
(based on existing Scatter3d)Chart.Cone
Chart.StreamTube
Chart.Volume
Chart.IsoSurface
Scene
param supportColorAxis
supportColorBar
supportcloses #126
closes #127
closes #128
closes #129
closes #130
closes #131