Let me add a few points to what Stonebridge has well explained.
If we have a straight line through the origin for a graph of V versus I, it does not matter whether you use a gradient or the ratio of V to I to find the resistance.
This can be shown using maths (direct proportion and differentiation) and I would leave it for you to prove it.
If it is an I-V graph where the graph is a
straight line through the origin, then we need the reciprocal of the gradient to find the resistance.
However, if the graph is a straight line
NOT through the origin, the use of gradient will not allow us to find the resistance.
This is why in general, we do not use the gradient of a V-I graph or I-V graph to find the resistance.
There are 2 statements in Stonebridge’s post that I find “disturbing”.
On a V against I graph, the gradient at a point should be dV/dI instead of dI/dV.
As for the last statement, I don’t really think gradients are drawn on a graph. I believe it is the tangent that we draw on a graph to evaluate the gradient.
PS: Stonebridge, I am sorry for being nitpicking.