Extending the plot beyond data with linearRegression

I have a simple plot with log scale on the Y axis, i want to extend the linearRegression beyond the data and the domain i have, is that possible with Plot’s linearRegression? and how?

1 Like

I don’t think this is currently possible, as the (x1, x2) extent is computed from the filtered index I on lines 110 and 119 of linearRegression.js.

Please open an issue with the suggestion? There might be ways to allow the user to specify an x1, x2 extent—or alternatively to use the unfiltered index, which would allow you to add points where x is defined by y isn’t.

2 Likes

Here’s a notebook that achieves this effect with D3:

3 Likes

Issue for Plot: Extend the domain of linearRegression · Issue #1555 · observablehq/plot · GitHub