I have a created a circle using the matplotlib library. Now in an infinite loop on every user input of x and y, I want to plot the point on the graph. How can I do this withour replotting everything again on user input?
This is what I have tried but this is not working
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['toolbar'] = 'None'
fig = plt.figure()
angle = np.linspace( 0 , 2 * np.pi , 1500 )
radius = 5
figure, axes = plt.subplots( 1 )
plt.title( 'Ring' )
plt.box(False)
plt.axis('off')
while True:
x = radius * np.cos( angle )
y = radius * np.sin( angle )
axes.plot( x, y )
axes.set_aspect( 1 )
# this is the part which I need to update without actually replotting my plot again
i_line = input("Enter the points ").split()
i_x, i_y = int(i_line[0]), int(i_line[1])
plt.scatter(i_x, i_y, color='red')
plt.show()