Skip to content

Conversation

@kMutagene
Copy link
Collaborator

@kMutagene kMutagene commented Sep 24, 2021

This PR adds full carpet Chart support.

  • CarpetCharts:
    • Chart.Carpet
    • Chart.ScatterCarpet
    • Chart.PointCarpet
    • Chart.LineCarpet
    • Chart.SplineCarpet
    • Chart.BubbleCarpet
    • Chart.ContourCarpet
  • CarpetLayout objects / StyleParams
  • docs
  • tests

-Carpetstyle options: Chart.withCarpetAnchor (ditched for mandatory carpetAnchorId argument for all constructors)

closes #198
closes #199
closes #200

@kMutagene
Copy link
Collaborator Author

All charts derived from ScatterCarpet:

let a = [4.; 5.; 5.; 6.]
let b = [1.; 1.; 2.; 3.]
let sizes = [5; 10; 15; 20]

let carpets = 
    [
        Chart.Carpet(
            "carpet1",
            A= [4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.],
            B= [1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.],
            Y= [2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.]
        )    
        Chart.Carpet(
            "carpet2",
            A= ([4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.] |> List.rev),
            B= ([1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.]|> List.rev),
            Y= ([2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.] |> List.map (fun x -> x + 10.))
        )        
        Chart.Carpet(
            "carpet3",
            A= [4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.],
            B= [1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.],
            Y= ([2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.] |> List.map (fun x -> x + 20.))
        )    
        Chart.Carpet(
            "carpet4",
            A= ([4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.] |> List.rev),
            B= ([1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.]|> List.rev),
            Y= ([2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.] |> List.map (fun x -> x + 30.))
        )        
        Chart.Carpet(
            "carpet5",
            A= ([4.; 4.; 4.; 4.5; 4.5; 4.5; 5.; 5.; 5.; 6.; 6.; 6.] |> List.rev),
            B= ([1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.; 1.; 2.; 3.]|> List.rev),
            Y= ([2.; 3.5; 4.; 3.; 4.5; 5.; 5.5; 6.5; 7.5; 8.; 8.5; 10.] |> List.map (fun x -> x + 40.))
        )
    ]
    |> Chart.combine

[
    carpets
    Chart.ScatterCarpet(
        a,b,
        StyleParam.Mode.Lines_Markers,
        "carpet1",
        Name = "Scatter",
        MultiMarkerSymbol =[
            StyleParam.MarkerSymbol.ArrowDown
            StyleParam.MarkerSymbol.TriangleNW
            StyleParam.MarkerSymbol.DiamondX
            StyleParam.MarkerSymbol.Hexagon2
        ],
        MultiSize = [
            10; 15; 20; 25
        ],
        Color = Color.fromColors ([Red; Blue; Green; Yellow] |> List.map Color.fromKeyword)
    )
    Chart.PointCarpet(a,b,"carpet2",Name = "Point")
    Chart.LineCarpet(a,b,"carpet3",Name = "Line")
    Chart.SplineCarpet(a,b,"carpet4",Name = "Spline")
    Chart.BubbleCarpet((Seq.zip3 a b sizes),"carpet5",Name = "Spline")
]
|> Chart.combine
|> Chart.withSize(Height=1000)
|> Chart.show

image

@kMutagene kMutagene marked this pull request as ready for review September 26, 2021 08:56
@kMutagene kMutagene merged commit bb5af9c into dev Sep 26, 2021
@kMutagene kMutagene deleted the carpet branch October 21, 2021 06:36
Sign up for free to 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.

Contour Carpet (reference) Scatter Carpet (reference) Carpet (reference)

2 participants