Skip to content

L-shaped scalebar #363

@swharden

Description

@swharden

I hacked this together manually, but an L-shaped scalebar plottable seems useful

image

for (int i = abf.sweepCount - 1; i >= 0; i--)
{
    double frac = (double)i / (abf.sweepCount - 1);
    Color color = Mix("#8181f2", "#a2f0ca", frac);
    var trace = abf.GetSweep(i);
    plt.PlotSignal(
        ys: trace.values,
        sampleRate: trace.sampleRate,
        color: color,
        yOffset: i * 15,
        xOffset: i * .025, 
        maxRenderIndex: 20000, lineWidth: 2);
}

// hack-in an L-shaped scalebar until ScottPlot supports it natively
plt.PlotLine(1.15, -50, 1.25, -50, lineWidth: 2, color: Color.Black);
plt.PlotLine(1.25, -50, 1.25, -10, lineWidth: 2, color: Color.Black);
plt.PlotText("100 ms", 1.2, -50, color: Color.Black, fontSize: 16,
    alignment: ScottPlot.TextAlignment.upperCenter);
plt.PlotText("40 mV", 1.25, -58, color: Color.Black, fontSize: 16, rotation: -90);

plt.Grid(false);
plt.Ticks(false, false);
plt.Frame(false);
plt.Resize(800, 600);

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