svg rasterization dpi patch

Hello,

i made a patch which would allow the svg backend to make
rasterized plots according to the dpi given in savefig.
I wanted this in order to have high-res scatter plots.
As you probably know it is hardcoded to 72 dpi right now.
The idea how to, came from the pdf backend. I mostly
copy pasted some code.

I also added a test for it. Some other tests now fail
the image comparison. It is nothing serious apparently.
Probably roundoff errors. Except interp_nearest_vs_none.
The result of which looks now exactly like the pdf which
it did not before.

Also, two other minor changes which i needed

- Compare_images failed for older numy versions. Simple fix ...
- A numpy.float32 variable got passed to the pdfRepr function in
backend_pdf.py. I changed this function to accept this type, too.

Cheers,
Michael

0001-fixed-compare_images-for-older-numpy-versions.-added.patch (1.67 KB)

0002-fix-dpi-setting-should-work-now-for-rasterization-in.patch (4.82 KB)

Michael,

Thank you, this sounds good. Although we can deal with it as a patch if necessary, it would be greatly preferable to see it as a github PR:
http://matplotlib.sourceforge.net/devel/gitwash/git_development.html#git-development

Are you willing to give that a try?

Eric

ยทยทยท

On 2012/08/26 5:50 AM, Michael Welter wrote:

Hello,

i made a patch which would allow the svg backend to make
rasterized plots according to the dpi given in savefig.
I wanted this in order to have high-res scatter plots.
As you probably know it is hardcoded to 72 dpi right now.
The idea how to, came from the pdf backend. I mostly
copy pasted some code.

I also added a test for it. Some other tests now fail
the image comparison. It is nothing serious apparently.
Probably roundoff errors. Except interp_nearest_vs_none.
The result of which looks now exactly like the pdf which
it did not before.

Also, two other minor changes which i needed

- Compare_images failed for older numy versions. Simple fix ...
- A numpy.float32 variable got passed to the pdfRepr function in
backend_pdf.py. I changed this function to accept this type, too.

Cheers,
Michael