Hello, I am having trouble with scatter plots. I created a
> scatter plot of just one point: s1 = scatter([1,],[1,])
> now I want to move this point after its creation and I'm
> not sure how to do this. I'm been looking around in teh
> documentation without any success. Is there something that
> might be close to the following:
It is possible but not advisable. scatter will be slower than plot
for this purpose, and since you have only one point there is not
reason to use a PolygonCollection, which is what scatter uses under
the hood. You can just
line, = ax.plot([1], [1])
and then call
>
line.set_xydata([2,],[2,])
But if I were just doing one point, I would create my own
matplotlib.patches.Polygon and use ax.add_patch to add it to the axes
and then manipulate the polygon properties directly.
mpl/examples> grep Polygon *
integral_demo.py:from matplotlib.patches import Polygon
integral_demo.py:poly = Polygon(verts, facecolor=0.8, edgecolor='k')
poly_editor.py:from matplotlib.patches import Polygon
poly_editor.py:class PolygonInteractor:
poly_editor.py:p = PolygonInteractor( circ)
mpl/examples> grep Circle *
picker_demo.py: p = Circle(center, radius=.1)
poly_editor.py:circ = Circle((.5,.5),.5)
JDH