Christian Lerrahn wrote: > Hi, > I'm plotting some 2D grid data using imshow(). However, one of my test > problems involves a Gaussian peak in the center of my grid. For some > strange reason this Gaussian looks like 5 distinct peaks. It looks like > the values are only set at the centers of my grid cells and then the > colour gradients are interpolate from this central point and a > background. > You can have a look at the original plot and a magnified one at > > http://www.maths.monash.edu.au/~clerrahn/gaussian1.png > http://www.maths.monash.edu.au/~clerrahn/gaussian2.png
The problem is that the colors are being set at the points by looking them up in the colormap, and the intermediate colors are being interpolated between those looked-up colors (this may be the point you are trying to make, but I couldn't be sure). The peak color is correct; it only looks like it is lower than the four surrounding points because that colormap is not a very good one for this kind of data. Use a single-hue colormap, instead. The alternative is to interpolate the *values* at the intermediate pixels first, and then look up the colors for each pixel in the colormap. This would give more reasonable results even with misapplied colormaps. However, it will probably be less efficient to implement. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users