matplotlib/matplotlib — pull request #1326 by ChrisBeaumont (2012-10-04 03:31:39+00:00)
Title: bugfix: creating patches with transform=None

In previous versions of matplotlib, passing `transform=None` to a `patches.Patch` object meant that the patch was specified in device coordinates (i.e., equivalent to `transform=transforms.IdentityTransform()`). This functionality seems to be broken at the moment. The following script demonstrates the problem; it should display a circle at data coordinates (2,2)

import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse

ax = plt.gca()
ax.set_xlim((1,3))
ax.set_ylim((1,3))

#draw an ellipse over data coord (2,2) by specifying device coords
xy_data = (2, 2)
xy_pix = ax.transData.transform_point(xy_data)
e = Ellipse(xy_pix, width=100, height=100, transform=None)

ax.add_patch(e)
plt.show()

I don't know the best way to fix this, but the attached code is one solution.