Jouni, Darren,
I'm not sure who the SVG expert is, and I presume the attached message
applies to pdf as well as ps. I'm bringing it to your attention because
it is suggesting what would seem to be significant improvements in some
backends by taking better advantage of their native image support. I
know nothing about this; would either of you (or anyone else) like to
comment?
Eric
--- Begin Message ---
Hello,
I am using matplotlib to create postscript and SVG files. I am
currently using imshow to show the contents of an array, but this
means that when saving vector graphics files, matplotlib resamples the
image/array onto a finer grid. What I would like, is for code such as
this:
import matplotlib
matplotlib.use('PS')
from matplotlib.pyplot import *
import numpy as np
image = np.random.random((10,10))
fig = figure(figsize=(4,4))
ax = fig.add_subplot(111)
ax.imshow(image)
fig.savefig('example1.ps')
fig = figure(figsize=(8,8))
ax = fig.add_subplot(111)
ax.imshow(image)
fig.savefig('example2.ps')
to produce files that are the roughly the same size, rather than
different by a factor of 4. In addition, both files should be very
small since they should only contain a 10x10 bitmap in addition to the
axes+labels. Postscript and SVG (as languages) both allow a bitmap of
an arbitrary resolution to be scaled, translated, and rotated without
resampling.
I have come across the figimage method which is meant to place an
array in a plot without resampling, but I cannot figure out how to use
it like imshow, i.e. to show the image inside the axes as before. I've
also tried the pcolor functions, but it seems like they define each
pixel as an individual polygon, which is inefficient.
I was wondering if anyone had a solution to this, or if there are
plans to make matplotlib behave like this in future?
Thanks,
Thomas
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
matplotlib-us...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--- End Message ---
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel