Created
January 28, 2013 16:55
-
-
Save btel/4657162 to your computer and use it in GitHub Desktop.
use custom colormaps with scatter and colorbra
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding=utf-8 | |
from matplotlib import cm | |
from matplotlib import colors | |
import numpy as np | |
import matplotlib.pyplot as plt | |
cm = colors.LinearSegmentedColormap.from_list( | |
"my_cmap", #nazwa (bez znaczenia) | |
['0.6', '0.3'], #min i max kolor ('0.3' to znaczy 30% szarosci) | |
N=10 # liczba poziomow | |
) | |
xy = np.arange(20) | |
sc = plt.scatter(xy, xy, c=xy, s=35, cmap=cm) | |
plt.colorbar(sc) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment