I'm trying to plot country flags as points on a x, y plane. So I am trying to prompt the user to enter a country name, and after it is plotted, i want the user to be able to enter another country name and for it to be plotted too, without losing the first point of course.
so basically I want the plot to keep updating whenever a user inputs a country. Here's the part of the code:
while True:
user_input = input('Enter Country: ')
for country, i, j, flag in zip(countries, xs, ys, flags):
if(user_input == item):
ax.scatter(i, j)
ab = AnnotationBbox(getImage(path), (i, j), frameon=False)
ax.add_artist(ab)
plt.show()
plt.pause(0.05)
print("Try Another Country")
It works fine with the first user input. For example, if I input "italy" Italian flag appears on the graph, but when I input the next country name, nothing changes and output keeps giving "Try Another Country"
Please Help!