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. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Lorenzo Isella wrote: > Eric Firing wrote: >> 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 >> > Dear Eric, > Thanks for your help. > (1) To be fair, I am quite a newbie and I do not know. I am using Debian > testing on my box; is there an easy way to find out what mpl I have > installed? However, I installed pylab from standard repositories, if > that matters. import matplotlib print matplotlib.__version__ > (2) Here I first present a script with fake data (basically I generate a > function for the contour plot) and the original one using two input > data files (I have no really other choice here, since with a function I > cannot reproduce the bug so far). The problem seems to be the previous plot, which is fouling up the colorbar axes tick labeling. This looks like a bug, but I have not tried to track it down. In any case if you don't make the previous plot then the colorbar labeling is OK. See attached modification of your second script. Eric