In [1]:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap

In [30]:
cdict1 = {'red':   ((0.0, 0.0, 0.0),
                   (0.5, 0.5, 0.5),
                   (1.0, 0.7, 0.7)),

         'green': ((0.0, 0.8, 0.8),
                   (0.5, 0.75, 0.75),
                   (1.0, 0.7, 0.7)),

         'blue':  ((0.0, 0.0, 0.0),
                   (0.5, 0.5, 0.5),
                   (1.0, 0.7, 0.7))
        }

In [31]:
cmap = LinearSegmentedColormap('GBG', cdict1)

In [52]:
%matplotlib inline
x = np.arange(0, np.pi, 0.1)
y = np.arange(0, 2*np.pi, 0.1)
X, Y = np.meshgrid(x,y)
Z = np.cos(X) * np.sin(Y) * 10

# Make the figure:

plt.figure(figsize=(6,6))

# Make 4 subplots:
ax = plt.subplot(111)
img = ax.imshow(Z, interpolation='nearest', cmap=cmap)
#ax.plot([0,1],[0,50])

cbar = plt.colorbar(img, orientation='horizontal')

cbar.set_ticks([])
cbar.set_ticklabels([])

plt.savefig('cbar.png')



In [83]:
import seaborn as sns

sns.set('talk')
sns.set_style('whitegrid')

In [85]:
xr = [88, 92, 99, 76, 87]
yr = [97, 70, 85, 88, 91]
zr = xr

xb = [10, 15, 6, 22, 16]
yb = [29, 6, 36, 15, 10]
zb = xb

# Make the figure:
plt.figure(figsize=(6,6))
ax = plt.subplot(111)

sc = ax.scatter(xr+xb, yr+yb, c=xr+xb, s=[25 for _ in xr+xb], cmap=cmap, marker='o')
#ax.scatter(xb, yb, c=xb, marker='o')
#ax.plot([0,1],[0,50])

ax.set_xlim([0,100])
ax.set_ylim([0,100])
ax.set_xticklabels([])
plt.xlabel('Color')
plt.ylabel('Density')
cbar = plt.colorbar(sc, pad=0.1, orientation='horizontal')

cbar.set_ticks([])
cbar.set_ticklabels([])
plt.savefig('talk.png')



In [ ]: