Black Lives Matter. Please consider donating to Black Girls Code today.

Plot a movable vertical line

So I have a 2D xy data and I want implement feature that will that will make the plot symmetric at about some some vertical axis through the point P on x axis, where P is in between the maximum and minimum limit of x. Now the user is going to provide the value of P. The easiest and trivial way to do is to get the value of P through a user input textbox but what I want to achieve is a little bit tricky (and fancy too). I want to provide a vertical movable line that the user can move along the x-axis and set it as the axis of symmetry and I am going to take the value of x from the position of the vertical line and use it as value of P. This way it would be more intuitive to select the axis of symmetry.
‌So how do I plot a vertical line that can be moved horizontally and take the position value from it? Any help is appreciated.