Eric Firing wrote:

Andrew Hawryluk wrote:

The interpolation algorithm used in imshow() can produce spurious

results, as has been noted before:

_http://article.gmane.org/gmane.comp.python.matplotlib.general/12062_

This happens because the data is converted to RGB before the

interpolation/resampling, rather than after. How hard would it be to

reverse this so that the data array is first interpolated & resampled

and then converted by cmap to RGB?

To me, it looks very hard. The color mapping is done first, in

python, and not repeated with

every draw. The interpolation is done by agg at rendering time.

Logically, I don't know any

reason why agg shouldn't do what you suggest: interpolate the scalar

field and then convert

to rgb.

Maybe agg can do it this way. If so, it would still take quite a

bit of work by someone

comfortable with agg (i.e., not me) to make the change.

Eric

Ah, that is certainly more difficult that what I would be prepared to

attempt, which is unfortunate because it would greatly improve the

output and reduce the interpolation's computation by a factor of three

(RGB).

Until someone feels up to the challenge, I will just add a manual

interpolation step when necessary for my data. e.g.:

import matplotlib.pyplot as p

import numpy as n

import scipy.ndimage

a = n.random.normal(size=(10,10))

p.imshow(a,interpolation='nearest') # the actual data

p.figure()

p.imshow(a,interpolation='bicubic') # an AGG interpolation of the RGB

values

b = scipy.ndimage.zoom(a,25)[:-24,:-24]

p.figure()

p.imshow(b) # the data interpolated at 25x magnification with a cubic

spline

Thanks for the information,

Andrew