Fix and new test for #3327

This PR replaces #3328 to fix #3327.
The fix is the same, but I'm using another branch to avoid having useless images in the repo history (see this [comment](https://github.com/matplotlib/matplotlib/pull/3328#issuecomment-50681965) in the old discussion).