v Set The Color Of A Matplotlib Plot - Python

Set The Color Of A Matplotlib Plot

Import numpy and matplotlib.pyplot

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

Create some simulated data.

n = 100
r = 2 * np.random.rand(n)
theta = 2 * np.pi * np.random.rand(n)
area = 200 * r**2 * np.random.rand(n)
colors = theta

Create a scatterplot using the a colormap.

Full list of colormaps: http://wiki.scipy.org/Cookbook/Matplotlib/Show_colormaps

c = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.RdYlGn)

png

c1 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.Blues)

png

c2 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.BrBG)

png

c3 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.Greens)

png

c4 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.RdGy)

png

c5 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.YlOrRd)

png

c6 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.autumn)

png

c7 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.binary)

png

c8 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.gist_earth)

png

c9 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.gist_heat)

png

c10 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.hot)

png

c11 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.spring)

png

c12 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.summer)

png

c12 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.winter)

png

c13 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.bone)

png

c14 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.cool)

png

c15 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.YlGn)

png

c16 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.RdBu)

png

c17 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.PuOr)

png

c18 = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.Oranges)

png