Issue
poly
is a given polygon.
>>> from matplotlib.figure import Figure
>>> import matplotlib as mpl
>>> fig = Figure(figsize=(10, 8))
>>> ax = fig.add_subplot()
>>> ax.add_patch(poly)
>>> poly
<matplotlib.patches.Polygon object at 0x7fbf5f313a90>
>>> poly.xy
array([[ 24.56, -32.63],
[ 30.36, -7.01],
[ 24.56, -32.63]])
>>> t = mpl.transforms.Affine2D().translate(2, 2)
>>> poly.set_transform(t + ax.transData)
>>> poly.xy
array([[ 24.56, -32.63],
[ 30.36, -7.01],
[ 24.56, -32.63]])
>>>
The polygon has been transformed, but it does not affect its xy
attribute.
How can I get the xy
of the transformed polygon?
Solution
Emilio drive me on the good track. But poly.get_transform()
seems to be different than the transformation itself.
The correct answer is: t.transform(poly.xy)
Answered By - albar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.