Last active
February 18, 2016 16:41
-
-
Save CnrLwlss/82da8b0cfcf9b962b031 to your computer and use it in GitHub Desktop.
Continuous colour map in python with matplotlib. Requires matplotlib 1.5?
This file contains hidden or 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
#http://matplotlib.org/examples/color/colormaps_reference.html | |
#http://matplotlib.org/users/colormaps.html | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
import numpy as np | |
N = 200 | |
x = np.random.randn(N) | |
y = np.random.randn(N) | |
colour = np.random.randn(N) | |
fig,ax=plt.subplots(2,2,figsize=(21,14)) | |
ax[0,0].scatter(x, y, c=colour, cmap=cm.plasma,linewidth=0,s=100) | |
ax[0,0].set_axis_bgcolor('lightgrey') | |
ax[0,1].scatter(x, y, c=colour, cmap=cm.cool,linewidth=0,s=100) | |
ax[0,1].set_axis_bgcolor('lightgrey') | |
ax[1,0].scatter(x, y, c=colour, cmap=cm.coolwarm,linewidth=0,s=100) | |
ax[1,0].set_axis_bgcolor('white') | |
ax[1,1].scatter(x, y, c=colour, cmap=cm.Paired,linewidth=0,s=100) | |
ax[1,1].set_axis_bgcolor('lightgrey') | |
plt.show() | |
plt.scatter(x, y, c=colour, cmap=cm.plasma,linewidth=0,s=100) | |
plt.colorbar() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment