views:

135

answers:

1

How do I add a small filled circle or point to a countour plot in matplotlib?

+4  A: 

Here is an example, using pylab.Circle:

import numpy as np
import pylab

X,Y=np.meshgrid(np.linspace(0,5,100),np.linspace(0,5,100))
F=X**Y
G=Y**X
pylab.contour(X,Y,(F-G),[0])
circ=pylab.Circle((2.71,2.71),radius=0.1)
ax=pylab.gca()
ax.add_patch(circ)
pylab.show()

And here is another example (though not a contour plot) from the docs.

Or, you could just use plot:

pylab.contour(X,Y,(F-G),[0])
pylab.plot([2.71],[2.71],'g.',markersize=20.0)
pylab.show()
unutbu