I’ve got a set of data points plotted with the below code, I have externally calculated that the line of best fit should be with the equation y=1.41119x but the current method of plotting it by manually calculating two points along it and using lq.line() is not the most readable in the code, and it also seems to not be possible to make the line of best fit go to the edge of the plot without manually scaling the axis.
Is there a way to either automatically draw a line of best fit for the data, or add on a line described by a y intercept and gradient?
Current code:
#align(center)[
#lq.diagram(
title: [Main method graph],
xlabel: [Mass ($#unit[g]$)],
ylabel: [$T^2$ ($#unit[s^2]$)],
width: 90%,
lq.scatter(
(0.09883, 0.20096, 0.30255, 0.40468, 0.50568),
(0.14,0.29,0.43,0.57,0.71),
),
// y=1.41119x
lq.line(
(0,0),
(0.50568,0.711542328),
stroke: (
dash: "dashed",
)
)
)
]
Current graph:
Notice how the line does not go all the way to the edge of the graph - I’m aware this can be done manually by scaling the axis, but an automatic solution would be better.
