matplotlib/matplotlib — pull request #1230 by dmcdougall (2012-09-11 00:45:28+00:00)
Title: Fix dpi issue for bitmaps on the OS X backend

Bitmaps were being generated from the NSView. NSImages, by default,
always use a dpi of 72. To generate a bitmap of a different size,
the image must be redrawn into a new rect. To resample the image at
a different resolution, a conversion is made to use the new dpi.

This is a first attempt at resolving issue #113.

I make no claim this is the only, or correct, way to do this. There may be other ways, but this code produces bone-fide legit 1000 dpi images:

```python
import matplotlib
matplotlib.use('macosx')
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(1, 1, 1)
fig.savefig('dpimac.tif', dpi=1000)
```

```bash
damon@quagmire:~
$ python dpimac.py
damon@quagmire:~
$ convert dpimac.tif dpimac.png
damon@quagmire:~
$ file dpimac.png
dpimac.png: PNG image data, 8000 x 6000, 8-bit/color RGBA, non-interlaced
```

It is now 1:45am and I have been bashing my head against the wall for about 4 hours trying to fix this. It is time for bed.

Feedback welcome :D