Skip to content

SP4: Simplify multi-axis API #2568

@swharden

Description

@swharden

XAxisIndex and YAxisIndex are confusing! So are XAxis2 and YAxis2

Implement non-breaking features which allows axes to be referenced as objects instead of integer indexes

Referencing axes:

ScottPlot.Plot plt = new();
plt.TopAxis.Label("top");
plt.BottomAxis.Label("bottom");
plt.RightAxis.Label("right");
plt.LeftAxis.Label("left");

Pairing axes with plottables:

ScottPlot.Plot plt = new();
var scatter1 = plt.AddScatter(/* */);
scatter1.YAxisIndex  = plt.LeftAxis.YAxisIndex;

var scatter2 = plt.AddScatter(/* */);
scatter2.YAxisIndex = plt.RightAxis.YAxisIndex;

var secondLeftAxis = plt.AddYAxis(Edge.Left);
var scatter3 = plt.AddScatter(/* */);
scatter3.YAxisIndex = secondLeftAxis.YAxisIndex;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions