matplotlib/matplotlib — pull request #1751 by mdboom (2014-08-25 20:14:41+00:00)
Title: Polygon is corrupted with SVG backend in a certain condition

Hi.

I found a path of Polygon is somewhat corrupted when save a figure as SVG. I have an imshow() an image and add a rectangle-like Polygon. Since I only need the edges of the Polygon, I set 'facecolor' to 'none'. The height of the Polygon is larger than the height of the image. When I saved the figure as SVG, the path of the Polygon is corrupted.

Interestingly, the problem occurs only when height of the figure is smallar then 3.3 (while keeping the width to 6.0), and when 'facecolor' of the Polygon is 'none'. The code at the bottom reproduces the problem.

I'm using the current master branch from github, and found the problem was introduced between v1.1.1 and v1.2.0. After bisecting between them, I found that the problem is introduced in c6cc861f3ac22a4063a52fb46c8d71fc4d7a26b9.

Thanks,

```python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Polygon

# Use mpl's default setting.
plt.matplotlib.rcdefaults()

# Proplem occurs when height is smaller than 3.3.
fig = plt.figure(figsize=(6.0, 3.2))
ax = fig.add_subplot(111)

im = np.zeros((480, 640))
bbox = [0, 140, 640, 260]
ax.imshow(
im[bbox[1]:bbox[1]+bbox[3],bbox[0]:bbox[0]+bbox[2]],
extent=(bbox[0],bbox[0]+bbox[2],bbox[1],bbox[1]+bbox[3]),
cmap='gray')

xy = [(297, 403), (303, 403), (304, 43), (296, 43)]
xy = xy + [xy[0]]
# Problem occurs when facecolor is 'none'.
ax.add_patch(Polygon(xy, facecolor='none', edgecolor='yellow'))

fig.savefig('foo.svg')
```