Resolution of SVG output

Hello MPL users,

I've been trying to create high-resolution graphics made with imshow()
for a publication lately and I can't seem to manage that. Attached you
can find an SVG file created with
canvas.print_figure("svg-dpi-test.svg", dpi=300)

Which should create a much higher resolution than it does. It doesn't
work to save it as eps first (even though I have less freedom to What
also got my attention was that when creating a figure with a high dpi
this does not increase dpi, but increases font-size. In my expectations
increasing dpi should not affect font-size, or if font-size is specified
in pixels it should decrease font-size. Now it seems as though font-size
is inversely correlated to dpi, which feels wrong. The reason I
elaborate on this is that it may be that I totally misunderstand the way
resolution is handled by MPL, in which case I would appreciate some
pointers.

Creating a PNG from the pop-up window by show()ing the output gives a
somewhat higher resolution, but also removes the freedom to change
things, and the maximum resolution seems to be limited by the
screen-size anyway. (It might be nice to include a resolution option there.)

Another issue I have with the SVG output is that the images are out of
their boxes on the bottom and on the right side. This only happens when
creating an SVG.

Any help would be appreciated!

Marius 't Hart.

svg-dpi-test.svg

This should help you understand dpi, font-size, etc.

http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize

However, I'm not sure how imshow() and SVG work together -- SVG is just that -- "Scalable", it doesn't have a set resolution, and I don't know what happens when you embed a raster graphic in it -- can someone offer an explanation of what MPL does with imshow and SVG?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Dear Chris,

That site really cleared the basic resolution stuff up for me, and it
was pretty much as I expected. Your remark about how imshow() works with
SVG made me wonder. Might it be that the output of imshow() is set in
pixels so that when I increase the dpi of the total figure, the subplots
decrease in their width and height as measured in inches? (Using the
extent parameter to rescale the bitmap?) This could explain the
'inverse' effect I experienced when increasing dpi. It is not limited to
SVG by the way, EPS and PNG have the same problem.

I got into these problems after upgrading from Ubuntu 6.06 to Ubuntu
6.10, thereby also upgrading from MPL 85.2 (?) to MPL 87.5. In the
previous version the SVG outputted would point to a PNG for each subplot
created with imshow(). Now the bitmaps seem to be included in the SVG
itself. Perhaps there is a way to increase the dpi of the included
bitmaps? (Or, if all else fails, some flag to get the old behavior back?)

Thanks very much,

Marius.

Christopher Barker schreef:

···

This should help you understand dpi, font-size, etc.

http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize

However, I'm not sure how imshow() and SVG work together -- SVG is
just that -- "Scalable", it doesn't have a set resolution, and I don't
know what happens when you embed a raster graphic in it -- can someone
offer an explanation of what MPL does with imshow and SVG?

-Chris

I wish I could help more, but I really have no clue about embedding images in SVG -- I haven't even used imshow() at all.

Perhaps there is a way to increase the dpi of the included
bitmaps?

A bitmap has a particular size -- period -- it can be re-scaled by interpolating, etc, but it has a given native size in pixels.

I think what may be confusing you is that if you take a given bitmap, and increase it's dpi -- all you've done is take the same pixels and tell whatever is doing your rendering that each pixel is smaller (so the whole image is smaller in length units (inches, etc). For example:

if you have an 800x600 bitmap at 100dpi, you have a 8"x6" picture. If you make it 200 dpi, you now have a 4"x3" picture, with smaller dots.

Does that help any?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...