JIM MacDonald wrote: > Hi, > > I'm trying to do a pcolor plot with a log normalised colour scale. > Following advice from past posts > to this list I specialised the matplotlib.colors.normalize class, and > passed an instance of that to > pcolor using the norm kwarg. > > This works fine :-) > > But when I add a colorbar it goes wrong. The colorbar is labelled with > the log of the values, rather > than values, and the colour only fills the top third of the colorbar.
In the absence of additional kwargs, colorbar uses norm.vmin and norm.vmax to determine the limits of the colorbar, and it uses a default formatter. It has no way of knowing that you have taken the log of your original values. > > Am I doing something wrong, or is this a problem with the colorbar? Colorbar will need some kwargs, at the very least. The "format" kwarg, for example, can be used to pass in a Formatter instance so that a label is 10^-3 instead of -3. I am not sure why only the top is colored in your example--it might be a bug or it might be an indication that additional kwargs are needed. I am reasonably sure there is a simple solution, but I can't look at it any more right now--maybe I can get back to it this evening. Eric > Any help would be much > appreciated. I realise that as a work around I could do a pcolor of > the log of my data and manually > relabel the colorbar, but it would be nice to do it properly. > > I've attached an png of the output and the code. Just in case the > attachments get stripped they are > also available to download from: > http://jimmacdonald.co.uk/pcolor_log.png > http://jimmacdonald.co.uk/pcolor_log.py > > I'm running the svn version (r2898--- lastest as of yesterday) with > numpy-1.0_rc1 on gentoo. > > Keep up the good work! > > Cheers, > > JIM ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel