# Color Bar in Contour Plot

Dear All,
Some weeks ago I emailed the list asking how to represent data on a non-rectangular domain (namely a velocity component along a tube cross-section in my case).
I now can tell that everything goes as in the example described by Hansen in Matplotlib-users Digest, Vol 14, Issue 13, which dealt about plotting a contour of gridded data.
However, when I try the following (rsin_t and rcos_t contain the position of a point on a circle, namely
(r*cos(t), r*sin(t)) ):

import pylab
#.... do my stuff here to load the data and manipulate the coordinates

#pylab.colorbar()
pylab.clf()
pylab.contourf(rsin_t.transpose(), rcos_t.transpose(), vel_section.transpose(),arange(min(ravel(vel_section)),(max(ravel(vel_section))+0.01),0.01),interpolation="bilinear",cmap=pylab.cm.jet)
pylab.colorbar()

#pylab.show()

pylab.savefig("velocity_on_section.png")
pylab.hold(False)

Everything is almost fine if it was not for the following two problems:
(1)the colorbar contains shows colors ranging from 0 to 1, whereas the represented scalar for the contour plot goes from 0 to 0.76.
(2)centered below the colorbar (not at its left-hand side, where there is a 0), there is a number with many digits which cannot be even properly read; I do not know where it comes from, but I would like to get rid of it.

Overall, pylab is doing everything I want, just I would like to iron out these last glitches, probably due to something I am doing wrong.
Many thanks for any suggestion here.

Lorenzo

Lorenzo,

1) What version of mpl are you using?

2) Please generate a short, simple stand-alone script that illustrates the problem. Use some minimal amount of fake data, preferably generated by a function rather than read from a table.

Eric

Lorenzo Isella wrote:

···

Dear All,
Some weeks ago I emailed the list asking how to represent data on a non-rectangular domain (namely a velocity component along a tube cross-section in my case).
I now can tell that everything goes as in the example described by Hansen in Matplotlib-users Digest, Vol 14, Issue 13, which dealt about plotting a contour of gridded data.
However, when I try the following (rsin_t and rcos_t contain the position of a point on a circle, namely
(r*cos(t), r*sin(t)) ):

import pylab
#.... do my stuff here to load the data and manipulate the coordinates

#pylab.colorbar()
pylab.clf()
pylab.contourf(rsin_t.transpose(), rcos_t.transpose(), vel_section.transpose(),arange(min(ravel(vel_section)),(max(ravel(vel_section))+0.01),0.01),interpolation="bilinear",cmap=pylab.cm.jet)
pylab.colorbar()

#pylab.show()

pylab.savefig("velocity_on_section.png")
pylab.hold(False)

Everything is almost fine if it was not for the following two problems:
(1)the colorbar contains shows colors ranging from 0 to 1, whereas the represented scalar for the contour plot goes from 0 to 0.76.
(2)centered below the colorbar (not at its left-hand side, where there is a 0), there is a number with many digits which cannot be even properly read; I do not know where it comes from, but I would like to get rid of it.

Overall, pylab is doing everything I want, just I would like to iron out these last glitches, probably due to something I am doing wrong.
Many thanks for any suggestion here.

Lorenzo

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.