Reputation: 27
as an example
import matplotlib.pyplot as plt
import random
pointx = random.random()
pointy = random.random()
plt.scatter(pointx , pointy)
circle = plt.Circle((.5,.55) , .07,color='b')
fig = plt.gcf()
fig.gca().add_artist(circle)
plt.show()
I only get the random xy point when I do this but when I remove the random xy point I get the circle. What can I do so I have both on one plot?
Upvotes: 0
Views: 984
Reputation: 8325
I think your circle is being plotted on top of your point try reversing it.
import matplotlib.pyplot as plt
import random
circle = plt.Circle((.5,.55) , .07,color='b')
fig = plt.gcf()
fig.gca().add_artist(circle)
pointx = random.random()
pointy = random.random()
plt.scatter(pointx , pointy)
plt.show()
Upvotes: 1