On Thu, Mar 22, 2012 at 1:43 AM, C M <cmpyt...@gmail.com> wrote:
> For the following code, if I remove the transform=None a green patch is
> shown. If it is in, it is not shown. I would think that transform=None
> should have no effect. Why is this?
>
This is a weird one: When you set the transform, the artist notices (sets
the `_transformSet` flag) and remembers that you set it. If the axes sees
that you've set the artist's transform, it won't override the artist's
transform<https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes.py#L795>with
the data transform (which is what properly scales your patch to the
data coordinates).
Best,
-Tony
>
> Thanks,
> Che
>
>
> import matplotlib.pyplot as plt
> import matplotlib.patches as patches
> from matplotlib.path import Path
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> start = 0.2
> stop = .6
>
> verts = [
> (start, .2), # left, bottom
> (start, .4), # left, top
> (stop, .4), # right, top
> (stop, .2), # right, bottom
> (0., 0.), # ignored
> ]
> codes = [Path.MOVETO,
> Path.LINETO,
> Path.LINETO,
> Path.LINETO,
> Path.CLOSEPOLY,
> ]
>
> path = Path(verts, codes)
>
> patch = patches.PathPatch(path, facecolor='g',
> lw=1, edgecolor='grey',transform=None )
>
> ax.add_patch(patch)
>
> plt.show()
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users