Alan G Isaac wrote:
> On Mon, 28 Jan 2008, Manuel Metz apparently wrote:
>> fig = pylab.figure(figsize=(6,10), dpi=96)
>> pylab.savefig("filename.eps", dpi=96)
> A couple questions.
> 1. The help for figure says that the dpi argument
> determines the "resolution". Suppose I am producing
> a PNG file for screen display: what am I changing
> when I change the dpi argument (from the point of
> view of the file, and from the point of viewer of
> the person viewing the file onscreen). More generally,
> are there standard setting recommended for onscreen
> PNG figure display?
For screen display, whether in interactive mode or when displaying a png
file, if you use a dpi value that matches the actual dpi of your screen,
then when you specify figsize in inches, your figure will actually
appear that size, fonts will be the right size, etc. If you use too
small a dpi value, the figure will be smaller than it should.
Screens vary. The screen on my laptop has about 130 dpi. Desktop flat
panels will usually have a smaller value than that. For example, an old
"15-inch" flat panel with 1024/768 pixels is actually about 12 inches
wide, so dpi=85. The mpl default 'figure.dpi' of 80 is low; I doubt
many modern screens come close to that. If I were recommending a
default, I would probably pick 100 or 110 as a middle-of-the-road match
to the range of modern screens, but I have not looked into it carefully.
> 2. EPS is a vector format, and the fig has a size.
> What role does the dpi argument play here?
Some information, such as images, must be encoded as pixels. The dpi
value in this case determines the resolution of an image, not the
physical size in inches. Using a large value will yield better
resolution at the cost of a larger file and slower rendering.