Skip to content
Advertisement

How to find the numeric value of the intersection point between an axvline and axline in matplotlib?

I have the code below and I needed to find the numerical value of the intersection point between the axline and the axvline, I have no idea how to solve this in a simple way, does anyone know how to solve it? Infinite thanks in advance! :)

JavaScript

Plot Result

Advertisement

Answer

First, you need to find the equation of the oblique line, y=slope*x+q: that’ easy to do, since you know the slope and a point of the line.

Next you solve the system of equations: y=slope*x+q, x=x0 (the vertical line).

Here I plotted the intersection point with a green marker.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement