Hi,

I am setting a colourbar where I explictly set the tick intervals. However I
would like to exclude the colour black from this colourbar. The reason for
this is I would like to overplot some contour lines in black, so would like
to make them stand out.

An example...where I would like to exclude black as the bottom colour of the
colourbar, i.e. use the next level of gray.

import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib as mpl

data = np.random.randint(0,50,100*100).reshape(100, 100) 
m = Basemap(llcrnrlon=1.5, llcrnrlat=10.5, urcrnrlon=3.5, urcrnrlat=13.5,
            resolution='c', projection='cyl') 
fig = plt.figure(figsize=(8, 6)) 
ax = fig.add_axes([0.1, 0.1, 0.6, 0.7])
m.ax = ax 

colourmap = plt.cm.Greys_r
ticks = [0, 10, 20, 30, 40, 50]
norm = colors.BoundaryNorm(ticks, colourmap.N)
im = m.imshow(data, colourmap, norm=norm, interpolation='nearest')
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.045, b, 0.05, h])           
cbar = mpl.colorbar.ColorbarBase(cax, cmap=colourmap, norm=norm,
ticks=ticks)
plt.show()

Many thanks,

Martin
-- 
View this message in context: 
http://old.nabble.com/Exclude-colour-from-a-colourbar-tp29699746p29699746.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to