Hi Eric,

Great that it works!! This is what I was looking for!

There is one thing left, which is that the tick labels are not exactly
at the boundary between the colors. (It is no problem for me, but I am
interested where it comes from). The script below shows that the
colorswitch is not exactly at an "even" number. The values
-0.022000001 and -0.022 are colored with the same color, whereas
-0.02200001 has a different color. I don't know whether this is the
reason for the ticks not beeing exactly at the intersection..?

I used the newest matplotlib version from the svn-repository.

I would use a script in the following way:
from pylab import *
from matplotlib import ticker


delta = 0.01
x = arange(-3.0, 3.0, delta)
y = arange(-3.0, 3.0, delta)
X,Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = Z2 - Z1 # difference of Gaussians

Z[20,20]=-0.022
Z[20,25]=-0.022000001
Z[20,30]=-0.02200001
Z[20,35]=-0.0220001
Z[20,40]=-0.022001
Z[20,45]=-0.02201

cmap = cm.get_cmap('jet', 10)    # 10 discrete colors

#### Set vmin and vmax beforehand
im = imshow(Z, cmap=cmap, vmin=-0.15, vmax=0.17, interpolation='nearest')

colorbar(ticks=linspace(im.norm.vmin, im.norm.vmax, 11))  # 11 tick labels



Thanks!

Claas :-)

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to