On Fri, Dec 10, 2010 at 11:00 AM, Ian Harry <ian.ha...@astro.cf.ac.uk>wrote:
> Hi Ben, > > Thanks for the suggestion, unfortunately I get: > > Traceback (most recent call last): > File "spin_bank.py", line 43, in ? > > newBlues = mcolors.LinearSegmentedColormap.from_list("newBlues", > cm.Blues._lut[cm.Blues.N/3:-3, :-1], 256) > AttributeError: class LinearSegmentedColormap has no attribute 'from_list' > > Am I missing something? > > Thanks > > Ian > > > > On 10 December 2010 15:50, Benjamin Root <ben.r...@ou.edu> wrote: > >> On Thu, Dec 9, 2010 at 9:01 AM, Ian Harry <ian.ha...@astro.cf.ac.uk>wrote: >> >>> Hi all, >>> >>> I am having a problem with manipulating colorbars. I want to take the >>> cm.Blues colorbar and edit it so that the lowest end of the colorbar is >>> light blue instead of white, or in other words I want to remove the lightest >>> 1/4 of the colorbar and just keep the darker end. >>> >>> Is there any easy way to do this? >>> >>> Any help would be greatly appreciated! >>> >>> Thanks >>> >>> Ian Harry >>> >>> >> Ian, >> >> First, as a point of semantics, you are talking about colormaps, not >> colorbars. >> >> I have attempted at one point a framework to allow users to manipulate >> colormaps, but it is very difficult to make it work in a generalized >> framework. However, it is "relatively" easier to specifically hack a >> particular colormap to get the results you need. >> >> import matplotlib.cm as cm >> import matplotlib.colors as mcolors >> >> cm.Blues._init() # forces it to internally create the '_lut' >> array >> newBlues = mcolors.LinearSegmentedColormap.from_list("newBlues", >> cm.Blues._lut[cm.Blues.N/3:-3, :-1], 256) >> >> This should create a new colormap by reinterpolating the last 2/3rds of >> the Blues colordata to a new 256 colors colormap. >> >> I hope this helps! >> >> Ben Root >> >> > > What version of matplotlib are you using? Ben Root
------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users