SharpPlot Reference > SharpPlot Properties > EquationFormat Property

SharpPlot.EquationFormat Property

Set Equation formatter.

public string EquationFormat {get; set;}


sp.EquationFormat = "Time = C0 + C1speed";

Simple Regression

The template is scanned for the strings C0,C1,C2 and so on, depending on the order of fit used. In the example, if the intercept was 2.3 and the slope was 0.42 the equation would read “Time = 2.3 + 0.42speed”. The “+” symbol in the template is a placeholder for the sign, so a negative slope would give a “-” sign here.

If a coefficient is zero, the matching term is omitted completely, so the above template could read “Time = 0.5speed” if the line went exactly through the origin.

You can use the special placeholder CC for correlation coefficient, and R2 for squared correlation coefficient, for example:

sp.EquationFormat = "Time = C0 + C1speed\nCorrelation = R2";

The formatted equation may be written on the fitted line, positioned according to the equation style, or recovered after the line has been drawn by referencing the “Equation” property. This may then be used as part of a note, or placed in the key text.

Multiple Regression

Note that for multiple regressions (Cloud charts and Scatterplots with the ‘contour’ option) the coefficients are generated in the order Int,x1,x2,...,y1,y2,...,y4 depending on the order of fit chosen for x and y. Set the EquationStyle to ‘forceOrigin’ to cut out the constant term and force the fit through the origin. In this case, the only way to display the equation is by referencing the ‘equation’ property and using this in a note or as part of the key.

Equation Font

Equation uses the NoteFont

See also ...

Formatting text with simple HTML tags | SharpPlot Members | SharpPlot.Equation Property (ReadOnly) | SharpPlot.EquationStyle Property

Send comments on this topic
© Dyalog Ltd 2016