In [1]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import cubehelix
# set up some simple data to plot
x = np.random.randn(10000)
y = np.random.randn(10000)
# so the cubehelix scheme works... but something is wacky above
fig = plt.figure(figsize=(10, 3.5))
fig.subplots_adjust(wspace=0.25, left=0.1, right=0.95, bottom=0.07, top=0.95)
plt.subplot(121)
cx1 = cubehelix.cmap(reverse=True)
plt.hexbin(x,y,gridsize=50,cmap=cx1)
plt.colorbar()
plt.subplot(122)
cx1 = cubehelix.cmap(start=0,rot=-0.5,reverse=True)
plt.hexbin(x,y,gridsize=50,cmap=cx1)
plt.colorbar()
Out[1]:
In [2]:
# image generated from script below, but run in standalone iPython shell
from IPython.display import Image
Image('/Users/james/python/cubehelix/rainbow.png',width=420,embed=True)
Out[2]:
In [3]:
%load /Users/james/python/cubehelix/test.py
In [4]:
import numpy as np
import matplotlib.pyplot as plt
import cubehelix
# set up some simple data to plot
x = np.random.randn(10000)
y = np.random.randn(10000)
cx1 = cubehelix.cmap(startHue=240,endHue=-300,minSat=1,maxSat=2.5,minLight=.3,maxLight=.8,gamma=.9)
plt.hexbin(x,y,gridsize=50,cmap=cx1)
plt.colorbar()
#plt.savefig('rainbow.png')
Out[4]: