I basically want to plot a line from a coordinate (x, y) with a given angle (calculating the tangent value).
With a simple line of code like this pl.plot([x1, x2], [y1, y2], 'k-', lw=1)
I can plot a line between two points but for this I need to calculate (x2, y2) coordinate. My (x1, y1) coordinate is fixed and the angle is known. Calculating (x2, y2) causes a problem at some point so I just want to plot the line from (x1, y1) with an angle (and preferably with a length).
The simplest solution I came up with that was to use point-slope function which is y - y1 = m(x - X1)
. Interpreting thiss and searching a little I used this piece of code:
x1 = 10
y1 = -50
angle = 30
sl = tan(radians(angle))
x = np.array(range(-10,10))
y = sl*(x-x1) + y1
pl.plot(x,y)
pl.show
sl is here slope and x1 and y1 are the coordinates. I needed to explain myself since this found to be a poor question.
So now, any ideas on how I can do/solve that?
x1 = 10 y1 = -50 angle = 30 sl = tan(radians(angle)) x = np.array(range(-10,10)) y = sl*(x-x1) + y1 pl.plot(x,y) pl.show
Here y is the equation of line and sl is the slope of that line. However that doesn't seem to work.