matplotlib/matplotlib — pull request #3860 by mdboom (2014-12-01 19:32:43+00:00)
Title: Behavior change in RegularPolyCollection from 1.3 to 1.4

Basically, the scaling of `RegularPolyCollection` changed by a factor of `1 / np.sqrt(np.pi)`. I believe the change is due to a refactor of the collections module: b8726d09026ba7507d8501de0fbd921ec2d1243e

Based on that diff, it looks like the behavior change might affect other collections. The example below creates a unit square in Matplotlib 1.3:

![square13](https://cloud.githubusercontent.com/assets/133031/5230736/cf302ca6-76df-11e4-989b-50de260d6531.png)

but in Matplotlib 1.4 the scaling changes the result to:

![square14](https://cloud.githubusercontent.com/assets/133031/5230740/d26f4a32-76df-11e4-8965-46a35523d527.png)

```python
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import collections
from matplotlib import transforms

class SquareCollection(collections.RegularPolyCollection):
"""Return a collection of squares."""

def __init__(self, **kwargs):
super(SquareCollection, self).__init__(4, rotation=np.pi/4., **kwargs)

def get_transform(self):
"""Return transform scaling circle areas to data space."""
ax = self.axes

# ---------------------------------------------------------------------
# Adding `/ np.sqrt(np.pi)` on MPL 1.4 gives same result as MPL 1.3
# Changed in b8726d09026ba7507d8501de0fbd921ec2d1243e
pts2pixels = 72.0 / ax.figure.dpi # / np.sqrt(np.pi)
# ---------------------------------------------------------------------

scale_x = pts2pixels * ax.bbox.width / ax.viewLim.width
scale_y = pts2pixels * ax.bbox.height / ax.viewLim.height
return transforms.Affine2D().scale(scale_x, scale_y)

fig, ax = plt.subplots(figsize=(3, 3))

xy = [(0, 0)]
# Unit square has a half-diagonal of `1 / sqrt(2)`, so `pi * r**2` equals...
circle_areas = [np.pi / 2]
squares = SquareCollection(sizes=circle_areas, offsets=xy,
transOffset=ax.transData)
ax.add_collection(squares, autolim=True)
ax.axis([-1, 1, -1, 1])

plt.grid()
plt.show()
```