In [2]:
import matplotlib.pyplot as plt

X = range(100)
Y = [value**2 for value in X]

plt.plot(X, Y)
plt.show()
Y


Out[2]:
[0,
 1,
 4,
 9,
 16,
 25,
 36,
 49,
 64,
 81,
 100,
 121,
 144,
 169,
 196,
 225,
 256,
 289,
 324,
 361,
 400,
 441,
 484,
 529,
 576,
 625,
 676,
 729,
 784,
 841,
 900,
 961,
 1024,
 1089,
 1156,
 1225,
 1296,
 1369,
 1444,
 1521,
 1600,
 1681,
 1764,
 1849,
 1936,
 2025,
 2116,
 2209,
 2304,
 2401,
 2500,
 2601,
 2704,
 2809,
 2916,
 3025,
 3136,
 3249,
 3364,
 3481,
 3600,
 3721,
 3844,
 3969,
 4096,
 4225,
 4356,
 4489,
 4624,
 4761,
 4900,
 5041,
 5184,
 5329,
 5476,
 5625,
 5776,
 5929,
 6084,
 6241,
 6400,
 6561,
 6724,
 6889,
 7056,
 7225,
 7396,
 7569,
 7744,
 7921,
 8100,
 8281,
 8464,
 8649,
 8836,
 9025,
 9216,
 9409,
 9604,
 9801]

In [3]:
import math

T = range(100)
X = [(2 * math.pi * t) / len(T) for t in T]
Y = [math.sin(value) for value in X]

plt.plot(X, Y)
plt.show()



In [4]:
import numpy as np

X = np.linspace(0, 2 * np.pi, 100)
Y = np.sin(X)

plt.plot(X, Y)
plt.show()



In [23]:
X = np.linspace(0, 2 * np.pi, 100)
Ya = np.sin(X)
Yb = np.cos(X)
plt.plot(X, Ya)
plt.plot(X, Yb)
plt.show()



In [33]:
def plot_slope(X, Y):
    Xs = X[1:] - X[:-1]
    Ys = Y[1:] - Y[:-1]
    plt.plot(X[1:], Ys / Xs)
   
X = np.linspace(-3,3,100)
Y = np.exp(-X **2)
print(X)
plt.plot(X,Y)
plot_slope(X,Y)
plt.show()


[-3.         -2.93939394 -2.87878788 -2.81818182 -2.75757576 -2.6969697
 -2.63636364 -2.57575758 -2.51515152 -2.45454545 -2.39393939 -2.33333333
 -2.27272727 -2.21212121 -2.15151515 -2.09090909 -2.03030303 -1.96969697
 -1.90909091 -1.84848485 -1.78787879 -1.72727273 -1.66666667 -1.60606061
 -1.54545455 -1.48484848 -1.42424242 -1.36363636 -1.3030303  -1.24242424
 -1.18181818 -1.12121212 -1.06060606 -1.         -0.93939394 -0.87878788
 -0.81818182 -0.75757576 -0.6969697  -0.63636364 -0.57575758 -0.51515152
 -0.45454545 -0.39393939 -0.33333333 -0.27272727 -0.21212121 -0.15151515
 -0.09090909 -0.03030303  0.03030303  0.09090909  0.15151515  0.21212121
  0.27272727  0.33333333  0.39393939  0.45454545  0.51515152  0.57575758
  0.63636364  0.6969697   0.75757576  0.81818182  0.87878788  0.93939394
  1.          1.06060606  1.12121212  1.18181818  1.24242424  1.3030303
  1.36363636  1.42424242  1.48484848  1.54545455  1.60606061  1.66666667
  1.72727273  1.78787879  1.84848485  1.90909091  1.96969697  2.03030303
  2.09090909  2.15151515  2.21212121  2.27272727  2.33333333  2.39393939
  2.45454545  2.51515152  2.57575758  2.63636364  2.6969697   2.75757576
  2.81818182  2.87878788  2.93939394  3.        ]

In [98]:
li = np.array([1,2,3,4,5])
ll = np.array([1,2,3,4,5])
li[1:]


Out[98]:
array([2, 3, 4, 5])

In [45]:
X, Y = [], []
for line in open('my_data.txt', 'r'):
    values = [float(s) for s in line.split()]
    X.append(values[0])
    Y.append(values[1])
    print(values)
plt.plot(X, Y)
plt.show()


[0.0, 0.0]
[1.0, 1.0]
[2.0, 4.0]
[4.0, 16.0]
[5.0, 25.0]
[6.0, 36.0]

In [51]:
with open('my_data.txt', 'r') as f:
    X,Y = zip(*[[float(s) for s in line.split()] for line in f])
plt.plot(X, Y)
plt.show()


(0.0, 1.0, 2.0, 4.0, 5.0, 6.0) (0.0, 1.0, 4.0, 16.0, 25.0, 36.0)

In [62]:
data = np.loadtxt('my_data.txt')
for i in range(len(data[0])):
    plt.plot(data[:,0],data[:, i])
plt.show()



In [106]:
data = np.random.rand(1024, 2)
print(data)
plt.scatter(data[:,0], data[:,1])
plt.show()


[[ 0.39221706  0.77280779]
 [ 0.73985205  0.03350308]
 [ 0.10030575  0.2527359 ]
 ..., 
 [ 0.22957173  0.74367686]
 [ 0.37502038  0.9934316 ]
 [ 0.52586905  0.70218786]]
Out[106]:
1024

In [100]:
data = [5., 25., 50., 20.]

plt.bar(range(len(data)), data, width=0.5)
plt.show()



In [95]:
data = [[5., 25., 50., 20.],
        [4., 23., 51., 17],
        [6., 22., 52., 19]]

X = np.arange(4)
plt.bar(X + 0.00, data[0], color = 'b', width = 0.25)
plt.bar(X + 0.25, data[1], color = 'g', width = 0.25)
plt.bar(X + 0.50, data[2], color = 'r', width = 0.25)
plt.show()
print(X)


[0 1 2 3]

In [108]:
data = [[5., 25., 50., 20.],
        [4., 23., 51., 17],
        [6., 22., 52., 19]]

color_list = ['b', 'g', 'r']
gap = .8/len(data)
for i, row in enumerate(data):
    X = np.arange(len(row))
    plt.bar(X + i * gap, row, width = gap, color = color_list[i % len(color_list)])
    print(len(color_list))
plt.show()


[]
3
3
3

In [114]:
data = np.array([[5., 25., 50., 20.],
        [4., 23., 51., 17],
        [6., 22., 52., 19]])

color_list = ['b', 'g', 'r']
X = np.arange(data.shape[1])
for i in range(data.shape[0]):
    plt.bar(X, data[i], bottom = np.sum(data[:i], axis=0), color = color_list[i])
    print( np.sum(data[:i], axis=0))
plt.show()


[ 0.  0.  0.  0.]
[  5.  25.  50.  20.]
[   9.   48.  101.   37.]

In [107]:
A = [5., 30., 45., 22.]
B = [5, 25, 50, 20]

X = range(4)

plt.bar(X, A, color = 'b')
plt.bar(X, B, color = 'r', bottom = 60)
plt.show()



In [119]:
women_pop = np.array([5, 30, 45, 22])
men_pop = np.array([5, 25, 50, 20])
X = np.arange(4)

plt.barh(X, women_pop, color = 'r')
plt.barh(X, -men_pop, color = 'b')
plt.show()



In [241]:
data = [5, 25, 50, 20,15, 27]
color_list = ['b', 'r', 'g', 'y']
plt.pie(data, colors= color_list)
plt.show()



In [147]:
X = np.random.randn(1000)

plt.hist(X)
plt.show()
len(X)


Out[147]:
1000

In [150]:
data = np.random.randn(100,5)

plt.boxplot(data)
plt.show()



In [153]:
import matplotlib.tri as tri

data = np.random.rand(100, 2)
triangles = tri.Triangulation(data[:,0], data[:,1])
plt.triplot(triangles)
plt.show()


<matplotlib.tri.triangulation.Triangulation object at 0x0000014E65535780>

In [156]:
def pdf(X, mu, sigma):
	a = 1. / (sigma * np.sqrt(2. * np.pi))
	b = -1. / (2. * sigma ** 2)
	return a * np.exp(b * (X - mu) ** 2)

X = np.linspace(-6, 6, 1024)

for i in range(5):
	samples = np.random.standard_normal(50)
	mu, sigma = np.mean(samples), np.std(samples)
	plt.plot(X, pdf(X, mu, sigma), color = '.75')

plt.plot(X, pdf(X, 0., 1.), color = 'k')

plt.show()



In [169]:
import numpy
import matplotlib.pyplot as plot

A = numpy.random.standard_normal((100, 2))
A += numpy.array((-1, -1))
A
B = numpy.random.standard_normal((100, 2))
B += numpy.array((1, 1))

plot.scatter(A[:,0], A[:,1], color = '.25')
plot.scatter(B[:,0], B[:,1], color = '.7')

plot.show()



In [107]:
import numpy
import matplotlib.pyplot as plot

label_list = (
	b'Iris-setosa',
	b'Iris-versicolor',
	b'Iris-virginica',
)

def read_label(label):
	return label_list.index(label)

data = numpy.loadtxt('iris.data.txt',
                     delimiter = ',',
                     converters = {4: read_label})
df = open('iris.data.txt', 'r')
# color_set = ('.00', '.50', '.25')
# color_list = [color_set[int(label)] for label in data[:,4]]

# plot.scatter(data[:,0], data[:,1], color = color_list)
# plot.show()
ff=[]
for line in df:
    ff.append(line.split())
ff[:,4]


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-107-f830bbf1831b> in <module>()
     23 for line in df:
     24     ff.append(line.split())
---> 25 ff[:,4]

TypeError: list indices must be integers or slices, not tuple

In [211]:
import numpy
import matplotlib.pyplot as plot

data = numpy.random.standard_normal((100, 2))

plot.scatter(data[:,0], data[:,1], color = '1.0', edgecolor='0.0')
plot.show()



In [105]:
import random
import matplotlib.pyplot as plot

values = [random.randint(0, 99) for i in range(50)]
values.sort()
color_set = ['.00', '.25', '.50', '.75']
color_list = [color_set[(len(color_set) * val) // 100] for val in values]

plot.bar(range(len(values)), values, color = color_list)
plot.show()
len(values)


Out[105]:
50

In [102]:
import numpy
import matplotlib.cm as cm
import matplotlib.pyplot as plot

N = 256
angle  = numpy.linspace(0, 8 * 2 * numpy.pi, N)

radius = numpy.linspace(.5, 1., N)

X = radius * numpy.cos(angle)

Y = radius * numpy.sin(angle)
# plot.scatter(X, Y, c = angle, cmap = cm.hsv)
# plot.scatter(X, Y, c = angle, cmap = cm.PuOr)
plot.plot(X,Y)
plot.show()



In [263]:
import random
import matplotlib.cm as cm
import matplotlib.colors as col
import matplotlib.pyplot as plot

values = [random.randint(0, 99) for i in range(50)]
values.sort()
print(values)
cmap = cm.ScalarMappable(col.Normalize(0, 99))

plot.bar(range(len(values)), values, color = cmap.to_rgba(values))
plot.show()


[2, 3, 17, 17, 21, 23, 24, 24, 25, 27, 33, 36, 37, 37, 38, 42, 42, 42, 43, 43, 44, 48, 51, 52, 53, 54, 58, 59, 61, 64, 65, 65, 66, 66, 67, 68, 68, 74, 76, 76, 77, 79, 81, 84, 90, 90, 95, 98, 98, 99]

In [269]:
import numpy
import matplotlib.pyplot as plot


def pdf(X, mu, sigma):
	a = 1. / (sigma * numpy.sqrt(2. * numpy.pi))
	b = -1. / (2. * sigma ** 2)
	return a * numpy.exp(b * (X - mu) ** 2)

X = numpy.linspace(-6, 6, 1024)

plot.plot(X, pdf(X, 0., 1.),   color = 'k' , linestyle = 'solid')
plot.plot(X, pdf(X, 0.,  .5),  color = 'k', linestyle = 'dashed')
plot.plot(X, pdf(X, 0.,  .25), color = 'k', linestyle = 'dashdot')

plot.show()



In [276]:
import numpy
import matplotlib.pyplot as plot

N = 8
A = numpy.random.random(N)
B = numpy.random.random(N)

plot.bar(range(N), A, color = '.75')
plot.bar(range(N), A + B, bottom = A, color = 'w', edgecolor='k', linestyle = 'dashdot')

plot.show()



In [274]:
import numpy
import matplotlib.pyplot as plot


def pdf(X, mu, sigma):
	a = 1. / (sigma * numpy.sqrt(2. * numpy.pi))
	b = -1. / (2. * sigma ** 2)
	return a * numpy.exp(b * (X - mu) ** 2)

X = numpy.linspace(-6, 6, 1024)

for i in range(64):
	samples = numpy.random.standard_normal(50)
	mu, sigma = numpy.mean(samples), numpy.std(samples)
	plot.plot(X, pdf(X, mu, sigma), color = '.75', linewidth = .5)

plot.plot(X, pdf(X, 0., 1.), color = 'k', linewidth = 3.)

plot.show()



In [281]:
import numpy
import matplotlib.pyplot as plot

N = 8
A = numpy.random.random(N)
B = numpy.random.random(N)

plot.bar(range(N), A, color = 'w',edgecolor = 'k', hatch = 'x')
plot.bar(range(N), A + B, bottom = A, color = 'w',edgecolor= 'k', hatch = '*')

plot.show()



In [282]:
import numpy
import matplotlib.pyplot as plot

X = numpy.linspace(0, 6, 1024)
Y1 = numpy.sin(X)
Y2 = numpy.cos(2 * X)

plot.fill_between(X, Y1, Y2, color = '.75')

plot.show()



In [283]:
import numpy
import matplotlib.pyplot as plot

A = numpy.random.standard_normal((100, 2))
A += numpy.array((-1, -1))

B = numpy.random.standard_normal((100, 2))
B += numpy.array((1, 1))

plot.scatter(A[:,0], A[:,1], color = 'k', marker = 'x')
plot.scatter(B[:,0], B[:,1], color = 'k', marker = '^')

plot.show()



In [6]:
# label_list = (
# 	b'Iris-setosa',
# 	b'Iris-versicolor',
# 	b'Iris-virginica',
# )

# def read_label(label):
# 	return label_list.index(label)

# data = np.loadtxt('iris.data.txt',
#                      delimiter = ',',
#                      converters = {4: read_label})

label_list = (b'Iris-setosa',b'Iris-versicolor',b'Iris-virginica',)

def read_label(label):
    return label_list.index(label)

data = np.loadtxt('iris.data.txt', delimiter = ',', converters = {4: read_label})

marker_set=('^', 'x', '.')
for i, marker in enumerate(marker_set):
    data_subset = np.asarray([x for x in data if x[4] == i])
    plt.scatter(data_subset[:,0], data_subset[:,1], color ='k', marker = marker)
plt.show()
data


Out[6]:
array([[ 5.1,  3.5,  1.4,  0.2,  0. ],
       [ 4.9,  3. ,  1.4,  0.2,  0. ],
       [ 4.7,  3.2,  1.3,  0.2,  0. ],
       [ 4.6,  3.1,  1.5,  0.2,  0. ],
       [ 5. ,  3.6,  1.4,  0.2,  0. ],
       [ 5.4,  3.9,  1.7,  0.4,  0. ],
       [ 4.6,  3.4,  1.4,  0.3,  0. ],
       [ 5. ,  3.4,  1.5,  0.2,  0. ],
       [ 4.4,  2.9,  1.4,  0.2,  0. ],
       [ 4.9,  3.1,  1.5,  0.1,  0. ],
       [ 5.4,  3.7,  1.5,  0.2,  0. ],
       [ 4.8,  3.4,  1.6,  0.2,  0. ],
       [ 4.8,  3. ,  1.4,  0.1,  0. ],
       [ 4.3,  3. ,  1.1,  0.1,  0. ],
       [ 5.8,  4. ,  1.2,  0.2,  0. ],
       [ 5.7,  4.4,  1.5,  0.4,  0. ],
       [ 5.4,  3.9,  1.3,  0.4,  0. ],
       [ 5.1,  3.5,  1.4,  0.3,  0. ],
       [ 5.7,  3.8,  1.7,  0.3,  0. ],
       [ 5.1,  3.8,  1.5,  0.3,  0. ],
       [ 5.4,  3.4,  1.7,  0.2,  0. ],
       [ 5.1,  3.7,  1.5,  0.4,  0. ],
       [ 4.6,  3.6,  1. ,  0.2,  0. ],
       [ 5.1,  3.3,  1.7,  0.5,  0. ],
       [ 4.8,  3.4,  1.9,  0.2,  0. ],
       [ 5. ,  3. ,  1.6,  0.2,  0. ],
       [ 5. ,  3.4,  1.6,  0.4,  0. ],
       [ 5.2,  3.5,  1.5,  0.2,  0. ],
       [ 5.2,  3.4,  1.4,  0.2,  0. ],
       [ 4.7,  3.2,  1.6,  0.2,  0. ],
       [ 4.8,  3.1,  1.6,  0.2,  0. ],
       [ 5.4,  3.4,  1.5,  0.4,  0. ],
       [ 5.2,  4.1,  1.5,  0.1,  0. ],
       [ 5.5,  4.2,  1.4,  0.2,  0. ],
       [ 4.9,  3.1,  1.5,  0.1,  0. ],
       [ 5. ,  3.2,  1.2,  0.2,  0. ],
       [ 5.5,  3.5,  1.3,  0.2,  0. ],
       [ 4.9,  3.1,  1.5,  0.1,  0. ],
       [ 4.4,  3. ,  1.3,  0.2,  0. ],
       [ 5.1,  3.4,  1.5,  0.2,  0. ],
       [ 5. ,  3.5,  1.3,  0.3,  0. ],
       [ 4.5,  2.3,  1.3,  0.3,  0. ],
       [ 4.4,  3.2,  1.3,  0.2,  0. ],
       [ 5. ,  3.5,  1.6,  0.6,  0. ],
       [ 5.1,  3.8,  1.9,  0.4,  0. ],
       [ 4.8,  3. ,  1.4,  0.3,  0. ],
       [ 5.1,  3.8,  1.6,  0.2,  0. ],
       [ 4.6,  3.2,  1.4,  0.2,  0. ],
       [ 5.3,  3.7,  1.5,  0.2,  0. ],
       [ 5. ,  3.3,  1.4,  0.2,  0. ],
       [ 7. ,  3.2,  4.7,  1.4,  1. ],
       [ 6.4,  3.2,  4.5,  1.5,  1. ],
       [ 6.9,  3.1,  4.9,  1.5,  1. ],
       [ 5.5,  2.3,  4. ,  1.3,  1. ],
       [ 6.5,  2.8,  4.6,  1.5,  1. ],
       [ 5.7,  2.8,  4.5,  1.3,  1. ],
       [ 6.3,  3.3,  4.7,  1.6,  1. ],
       [ 4.9,  2.4,  3.3,  1. ,  1. ],
       [ 6.6,  2.9,  4.6,  1.3,  1. ],
       [ 5.2,  2.7,  3.9,  1.4,  1. ],
       [ 5. ,  2. ,  3.5,  1. ,  1. ],
       [ 5.9,  3. ,  4.2,  1.5,  1. ],
       [ 6. ,  2.2,  4. ,  1. ,  1. ],
       [ 6.1,  2.9,  4.7,  1.4,  1. ],
       [ 5.6,  2.9,  3.6,  1.3,  1. ],
       [ 6.7,  3.1,  4.4,  1.4,  1. ],
       [ 5.6,  3. ,  4.5,  1.5,  1. ],
       [ 5.8,  2.7,  4.1,  1. ,  1. ],
       [ 6.2,  2.2,  4.5,  1.5,  1. ],
       [ 5.6,  2.5,  3.9,  1.1,  1. ],
       [ 5.9,  3.2,  4.8,  1.8,  1. ],
       [ 6.1,  2.8,  4. ,  1.3,  1. ],
       [ 6.3,  2.5,  4.9,  1.5,  1. ],
       [ 6.1,  2.8,  4.7,  1.2,  1. ],
       [ 6.4,  2.9,  4.3,  1.3,  1. ],
       [ 6.6,  3. ,  4.4,  1.4,  1. ],
       [ 6.8,  2.8,  4.8,  1.4,  1. ],
       [ 6.7,  3. ,  5. ,  1.7,  1. ],
       [ 6. ,  2.9,  4.5,  1.5,  1. ],
       [ 5.7,  2.6,  3.5,  1. ,  1. ],
       [ 5.5,  2.4,  3.8,  1.1,  1. ],
       [ 5.5,  2.4,  3.7,  1. ,  1. ],
       [ 5.8,  2.7,  3.9,  1.2,  1. ],
       [ 6. ,  2.7,  5.1,  1.6,  1. ],
       [ 5.4,  3. ,  4.5,  1.5,  1. ],
       [ 6. ,  3.4,  4.5,  1.6,  1. ],
       [ 6.7,  3.1,  4.7,  1.5,  1. ],
       [ 6.3,  2.3,  4.4,  1.3,  1. ],
       [ 5.6,  3. ,  4.1,  1.3,  1. ],
       [ 5.5,  2.5,  4. ,  1.3,  1. ],
       [ 5.5,  2.6,  4.4,  1.2,  1. ],
       [ 6.1,  3. ,  4.6,  1.4,  1. ],
       [ 5.8,  2.6,  4. ,  1.2,  1. ],
       [ 5. ,  2.3,  3.3,  1. ,  1. ],
       [ 5.6,  2.7,  4.2,  1.3,  1. ],
       [ 5.7,  3. ,  4.2,  1.2,  1. ],
       [ 5.7,  2.9,  4.2,  1.3,  1. ],
       [ 6.2,  2.9,  4.3,  1.3,  1. ],
       [ 5.1,  2.5,  3. ,  1.1,  1. ],
       [ 5.7,  2.8,  4.1,  1.3,  1. ],
       [ 6.3,  3.3,  6. ,  2.5,  2. ],
       [ 5.8,  2.7,  5.1,  1.9,  2. ],
       [ 7.1,  3. ,  5.9,  2.1,  2. ],
       [ 6.3,  2.9,  5.6,  1.8,  2. ],
       [ 6.5,  3. ,  5.8,  2.2,  2. ],
       [ 7.6,  3. ,  6.6,  2.1,  2. ],
       [ 4.9,  2.5,  4.5,  1.7,  2. ],
       [ 7.3,  2.9,  6.3,  1.8,  2. ],
       [ 6.7,  2.5,  5.8,  1.8,  2. ],
       [ 7.2,  3.6,  6.1,  2.5,  2. ],
       [ 6.5,  3.2,  5.1,  2. ,  2. ],
       [ 6.4,  2.7,  5.3,  1.9,  2. ],
       [ 6.8,  3. ,  5.5,  2.1,  2. ],
       [ 5.7,  2.5,  5. ,  2. ,  2. ],
       [ 5.8,  2.8,  5.1,  2.4,  2. ],
       [ 6.4,  3.2,  5.3,  2.3,  2. ],
       [ 6.5,  3. ,  5.5,  1.8,  2. ],
       [ 7.7,  3.8,  6.7,  2.2,  2. ],
       [ 7.7,  2.6,  6.9,  2.3,  2. ],
       [ 6. ,  2.2,  5. ,  1.5,  2. ],
       [ 6.9,  3.2,  5.7,  2.3,  2. ],
       [ 5.6,  2.8,  4.9,  2. ,  2. ],
       [ 7.7,  2.8,  6.7,  2. ,  2. ],
       [ 6.3,  2.7,  4.9,  1.8,  2. ],
       [ 6.7,  3.3,  5.7,  2.1,  2. ],
       [ 7.2,  3.2,  6. ,  1.8,  2. ],
       [ 6.2,  2.8,  4.8,  1.8,  2. ],
       [ 6.1,  3. ,  4.9,  1.8,  2. ],
       [ 6.4,  2.8,  5.6,  2.1,  2. ],
       [ 7.2,  3. ,  5.8,  1.6,  2. ],
       [ 7.4,  2.8,  6.1,  1.9,  2. ],
       [ 7.9,  3.8,  6.4,  2. ,  2. ],
       [ 6.4,  2.8,  5.6,  2.2,  2. ],
       [ 6.3,  2.8,  5.1,  1.5,  2. ],
       [ 6.1,  2.6,  5.6,  1.4,  2. ],
       [ 7.7,  3. ,  6.1,  2.3,  2. ],
       [ 6.3,  3.4,  5.6,  2.4,  2. ],
       [ 6.4,  3.1,  5.5,  1.8,  2. ],
       [ 6. ,  3. ,  4.8,  1.8,  2. ],
       [ 6.9,  3.1,  5.4,  2.1,  2. ],
       [ 6.7,  3.1,  5.6,  2.4,  2. ],
       [ 6.9,  3.1,  5.1,  2.3,  2. ],
       [ 5.8,  2.7,  5.1,  1.9,  2. ],
       [ 6.8,  3.2,  5.9,  2.3,  2. ],
       [ 6.7,  3.3,  5.7,  2.5,  2. ],
       [ 6.7,  3. ,  5.2,  2.3,  2. ],
       [ 6.3,  2.5,  5. ,  1.9,  2. ],
       [ 6.5,  3. ,  5.2,  2. ,  2. ],
       [ 6.2,  3.4,  5.4,  2.3,  2. ],
       [ 5.9,  3. ,  5.1,  1.8,  2. ]])

In [12]:
import numpy
import matplotlib.pyplot as plot

X = numpy.linspace(-6, 6, 1024)
Y1 = numpy.sinc(X)
Y2 = numpy.sinc(X) + 1

plot.plot(X, Y1, marker = 'o', color = '.75')
plot.plot(X, Y2, marker = 'o', color = 'k', markevery = 130)

plot.show()
len(X)


Out[12]:
1024

In [19]:
import numpy
import matplotlib.pyplot as plot

X = numpy.linspace(-6, 6, 1024)
Y = numpy.sinc(X)

plot.plot(X, Y,
          linewidth = 9.,
          color = 'k',
          markersize = 14,
          markeredgewidth = 2.5,
          markerfacecolor = '.88',
          markeredgecolor = 'k',
          marker = 'o',
          markevery = 150)

plot.show()



In [22]:
import numpy
import matplotlib.pyplot as plot

A = numpy.random.standard_normal((100, 2))
A += numpy.array((-1, -1))

B = numpy.random.standard_normal((100, 2))
B += numpy.array((1, 1))

plot.scatter(B[:,0], B[:,1], c = 'k', s = 200.)
plot.scatter(A[:,0], A[:,1], c = 'y', s = 25.)

plot.show()



In [28]:
import numpy
import matplotlib.pyplot as plot

M = numpy.random.standard_normal((1000, 2))
R = numpy.sum(M ** 2, axis = 1)

plot.scatter(M[:, 0], M[:, 1], c = 'b', marker = 's', s = 8. * R)
plot.show()
8*R


Out[28]:
array([  4.46486961e-01,   9.40508635e+00,   3.94624686e+00,
         2.42309607e+01,   2.63282321e+00,   1.42230763e+00,
         3.70858024e+00,   2.31148785e+00,   9.15646592e+00,
         3.82619198e+01,   5.03947043e+00,   3.41281354e+00,
         1.81616987e+00,   1.19242156e+01,   1.54701887e+01,
         2.73093882e+01,   6.38239451e+00,   5.18285494e-01,
         1.67479495e+01,   2.96417054e+01,   2.73732920e+00,
         6.25210722e+00,   1.43102774e+01,   1.91988367e+00,
         1.52520828e+01,   1.84632550e+00,   4.08181655e+00,
         2.84462770e+01,   1.86667433e+01,   3.26508540e+01,
         6.86704276e+00,   8.62920869e-01,   2.87355558e+00,
         1.58541938e+01,   2.23409512e+01,   1.21627388e+01,
         6.36714615e+01,   1.65444946e+01,   3.80424830e+01,
         1.12378095e+01,   8.89240631e+00,   5.66417234e+01,
         4.41944318e+00,   1.69617429e+00,   1.90112997e+01,
         2.48235566e+00,   3.87567221e+00,   1.50626969e+01,
         8.06812210e+00,   6.68892782e-01,   7.33829305e+01,
         5.77666543e+00,   1.02388657e+01,   4.30518033e+00,
         3.65670350e+00,   1.79978448e+00,   7.30734728e+00,
         3.49983729e+00,   6.59802285e+00,   3.24223893e+01,
         1.19367852e+00,   1.07952479e+01,   4.01701459e+01,
         5.96617917e+00,   1.29931723e+00,   3.38578851e+01,
         2.09589414e+01,   2.26698679e+00,   2.85929481e+01,
         3.87111485e+00,   7.90938731e+00,   7.77155905e+00,
         7.86415361e+00,   7.92750064e+00,   4.54009188e+00,
         1.38748397e+00,   9.75286570e-02,   8.08652420e+00,
         4.40984762e+00,   3.51637951e+00,   4.69641023e+00,
         3.91896216e+00,   2.21755101e+00,   1.85740404e+01,
         3.61708892e+00,   4.90907790e-01,   2.26228304e+01,
         1.25662428e+01,   4.70407107e+01,   5.26849140e+00,
         1.42803675e+01,   2.20120091e+01,   2.06752065e+01,
         2.79154440e+01,   1.62238976e+01,   4.44998482e+01,
         7.75598760e-02,   1.58757069e+00,   3.53868655e+01,
         9.54534528e+00,   2.70257662e+00,   5.85150315e+01,
         1.54841006e+01,   8.21714936e+00,   1.59526352e+01,
         2.51886032e+00,   4.45915191e+00,   2.69780170e+01,
         3.57128091e+00,   1.88872142e+01,   4.19562175e+01,
         1.12730891e+01,   1.97273587e+01,   1.37001390e+00,
         1.39158266e+01,   1.23554858e+01,   1.69099241e+01,
         8.90526731e+00,   8.08554617e+00,   1.32201914e+01,
         1.81731385e+01,   5.20959139e+01,   2.19184389e+01,
         1.52476094e+01,   6.98315767e+00,   9.10540520e+00,
         2.46720757e+01,   5.66428514e+00,   8.31338434e+00,
         4.00749388e+00,   3.48477724e+01,   1.32654482e+01,
         1.00035066e-01,   2.14558051e+01,   1.14728885e+01,
         3.67062976e+00,   2.88083963e+01,   7.40510075e+00,
         2.59671159e+01,   6.41125619e+00,   3.52580854e+00,
         5.30020318e+00,   1.25370826e+00,   3.05411230e+00,
         2.40649107e+00,   2.34956860e+01,   3.05501576e+01,
         1.29640157e+01,   1.54496184e+00,   3.42005884e+00,
         4.82142907e+00,   5.98025191e-01,   6.17569177e+00,
         1.49844973e+01,   4.29254395e+00,   3.36648639e+01,
         1.13327044e+00,   2.99105057e+01,   1.41544512e+01,
         2.42482171e+01,   5.56411441e-01,   3.85216745e+01,
         9.77291407e+00,   2.44454215e+01,   1.78510218e+00,
         1.65403295e+01,   1.76410762e+01,   1.86290459e+01,
         4.55257920e+00,   2.01357293e+01,   1.68607127e+01,
         9.13933392e+00,   1.59751750e+01,   1.87977138e+00,
         1.82839506e+01,   2.66014088e+01,   2.60744732e+01,
         4.10725542e+01,   4.75499102e+00,   3.41972766e+00,
         1.92310421e+00,   7.29142339e+00,   1.68091345e+01,
         2.64413024e+01,   8.58843327e+00,   4.17190182e+00,
         9.32379971e-01,   2.43995067e+01,   4.53490334e+01,
         2.95868351e+01,   2.61434215e+01,   9.33567167e+00,
         8.61029129e-01,   1.38667447e+01,   1.88509152e+01,
         1.17796436e+01,   8.64201939e+00,   1.62351737e+00,
         1.13845877e+01,   3.68585962e+01,   3.51705504e+00,
         2.05888090e+01,   5.45563658e+00,   2.17533026e+01,
         2.54126926e+00,   1.88999403e+00,   5.33387464e+00,
         1.09288287e+01,   7.76214578e+01,   4.02054592e+01,
         4.31652756e+01,   2.44412418e+01,   2.13226428e+01,
         2.32040620e+01,   7.45041964e+00,   6.20798628e+00,
         3.99589136e+01,   7.64111484e+00,   1.05847480e+01,
         3.37602834e+01,   2.35166158e+01,   4.78237796e+01,
         2.29558394e-01,   4.44990360e+00,   1.00911046e+00,
         2.71422887e+00,   1.71930210e+01,   5.21445217e+01,
         7.86596523e+00,   3.34550993e+00,   4.05122983e+01,
         4.06033992e+01,   3.36190361e+00,   3.51625203e+00,
         1.09323631e+01,   4.12789521e+01,   6.66725579e+00,
         1.90428644e+01,   4.55349235e+00,   1.42184784e+01,
         2.43338165e+01,   1.21166441e+01,   4.71911985e+00,
         3.73324881e+00,   2.04750791e+01,   6.35293021e+01,
         1.28044603e+01,   3.72338075e+00,   1.69431473e+01,
         2.61264455e+01,   4.46322150e+01,   3.33485457e+00,
         5.36994943e+00,   2.85419775e+01,   2.56493448e+00,
         2.42992992e+00,   2.54039807e+01,   1.79472438e+01,
         3.27208843e+00,   5.93387755e+01,   1.26797409e+01,
         2.19335062e+01,   1.96914999e-01,   3.14976534e+00,
         1.16156916e+01,   7.82040045e+00,   6.57350427e-01,
         3.18135264e+01,   1.69356310e+01,   1.18095489e+01,
         2.79160570e+01,   6.78587023e-01,   1.17376325e+00,
         1.45173069e+00,   4.80066956e+01,   6.82129667e+00,
         1.33282853e+01,   1.71330620e+01,   8.34639722e+00,
         3.41671934e+01,   3.23251372e+00,   1.41109655e-01,
         2.91202430e+01,   1.33603825e+01,   7.29784440e+00,
         3.03407574e+01,   3.05273713e+01,   2.15752046e+01,
         6.10682282e+00,   2.06842176e+01,   7.40275454e+01,
         5.86825160e+00,   2.26971171e+01,   1.14587837e+01,
         6.58943761e+00,   1.06533543e+00,   3.77999485e+00,
         1.70577893e+01,   1.07351241e+01,   1.07925889e+01,
         1.26140463e+01,   1.75665769e+00,   1.07059734e+01,
         2.97635610e+01,   1.04213942e+00,   1.84902358e+00,
         4.54478630e+00,   1.22907238e+01,   5.46671713e-03,
         3.82433725e+00,   2.09500772e+00,   2.38612666e+00,
         1.41444650e+01,   4.13677713e+00,   1.89339254e+01,
         6.12628388e+01,   1.26076561e+01,   3.30241097e+01,
         2.85023425e+01,   2.54913121e+00,   8.45452594e+00,
         1.66773365e+00,   2.09687678e+01,   2.04491515e+01,
         2.23554317e+01,   4.48221430e+00,   6.20970340e+00,
         1.34702655e+01,   3.73207399e+00,   1.04638415e+01,
         1.72898504e+01,   2.87988981e+00,   6.00002767e+01,
         4.60731349e+00,   7.85841850e+00,   3.19087546e+01,
         1.89509054e+00,   1.43443496e+01,   1.36914832e+00,
         3.83402025e+00,   1.15340832e+01,   1.95843491e+01,
         2.63789277e+00,   2.67123671e+01,   4.02124876e+01,
         1.65536328e+01,   1.91181989e+01,   5.49167729e+01,
         3.43548164e+01,   2.88666465e+00,   1.09075968e+01,
         1.40436620e+00,   9.42818967e+00,   1.87723436e+01,
         8.13201614e+00,   1.40403330e+00,   1.78732611e+01,
         2.89368617e+01,   2.59246971e+01,   1.62896456e+01,
         1.21223619e+01,   5.73827488e+00,   3.51972252e+01,
         1.12208809e+01,   1.74738528e+01,   2.76621053e+01,
         4.45690116e+01,   4.52707406e+00,   1.79814791e+01,
         3.86040559e+01,   2.32124033e+01,   1.19055441e+01,
         1.71681475e+00,   8.65221930e+00,   1.68424237e+01,
         4.02760802e+01,   7.29073933e-01,   1.11923646e+01,
         1.89646086e+00,   2.95047529e+01,   1.94083431e+00,
         1.11970372e+01,   5.34186321e+00,   3.28033144e+01,
         1.60118897e+01,   2.27153666e+01,   1.04906080e+01,
         7.71943674e+01,   5.35949265e+00,   9.56798910e+00,
         1.16545735e+01,   9.99439598e+00,   3.28171924e+00,
         2.13430606e+01,   1.34056489e+01,   9.44899294e+00,
         6.35685061e+00,   2.55786492e+00,   2.97134737e+01,
         1.95678132e-02,   4.68878000e+01,   4.43086259e+01,
         5.43419147e+00,   1.53927927e+00,   2.77952286e+01,
         2.95738060e+01,   5.09283388e-01,   2.14344748e+01,
         3.06138906e+01,   1.03966920e+01,   1.76974269e+01,
         6.66038947e+00,   4.01065024e-01,   1.88385513e+01,
         1.84713706e+00,   2.88514935e+01,   3.18425527e+01,
         3.92326888e+01,   5.73184580e-02,   1.70471261e+01,
         2.99109938e-01,   9.39206232e+00,   3.26091994e-02,
         1.60512172e+01,   1.95205759e+01,   2.41854687e+01,
         1.08962922e+01,   4.67869487e+01,   5.58765039e+00,
         3.10959643e+01,   3.79678971e+00,   8.81492537e+00,
         7.67953785e+00,   4.65767827e-01,   6.99369971e+00,
         1.16849487e+00,   1.96251715e+00,   1.69437423e+01,
         1.07341047e+00,   1.76132067e+01,   1.07037267e+01,
         6.69043310e+00,   1.43475802e+01,   3.39890143e+01,
         2.47694387e+01,   1.93698835e+00,   1.36258881e+00,
         8.98403921e+00,   3.90665327e+00,   2.12017824e+01,
         8.12525655e+00,   5.60107179e+00,   4.69396562e+01,
         5.10032937e-01,   7.46958061e+00,   3.57607769e+00,
         1.13711040e+01,   2.60789367e+01,   2.91091442e+00,
         2.07723026e+01,   4.51220722e+00,   4.91780458e+00,
         5.75565865e+00,   1.11855762e+00,   5.37218379e+00,
         9.32388113e+00,   8.36693946e+01,   7.82125898e+00,
         1.94519395e+01,   2.10160960e-01,   4.49171440e+00,
         2.70747100e+01,   5.90734046e+00,   8.16555492e+00,
         5.83750478e+00,   2.43696189e+00,   3.09847501e+01,
         4.05654869e+01,   1.55422747e+01,   2.16033694e+01,
         2.54562843e+01,   4.05080879e+01,   3.83139707e+00,
         5.00968911e+01,   2.11540881e+01,   1.98731920e+01,
         1.56800847e+01,   2.39558628e+01,   7.61871825e+00,
         5.67876558e+00,   1.79483833e+01,   5.92679189e+00,
         2.29808811e+01,   4.78418519e+00,   4.88413413e+01,
         5.77863366e+00,   3.31681709e+01,   2.58141860e+01,
         1.40413636e+01,   1.82187045e+01,   3.72951999e+01,
         2.16434733e-01,   3.49415524e+01,   5.63103996e+01,
         1.34165085e+01,   6.42646780e+00,   2.04240095e+01,
         2.60719029e+01,   5.99855950e+00,   5.51238505e+00,
         6.59884165e+00,   2.71000301e+01,   1.36111147e+01,
         1.21325298e+01,   5.97724950e+00,   1.94048124e+01,
         4.13293018e+01,   7.44726800e+00,   3.02477424e+00,
         1.58348849e+01,   7.08529349e+00,   2.83801965e+01,
         2.61092358e+01,   9.64971242e+00,   2.41274485e+00,
         6.55105598e+00,   1.03894738e+01,   5.91780238e+00,
         1.28202900e+01,   3.00410602e+01,   2.08853683e+01,
         4.20570131e+01,   4.23776220e+01,   1.15344889e+01,
         4.94964967e+01,   3.81322294e+00,   5.27324284e+00,
         2.08638722e+00,   1.69511093e+01,   2.45188309e+01,
         2.49156495e+00,   1.00010049e+01,   1.40137264e+01,
         2.35607363e+01,   3.05301187e+00,   1.64256602e+01,
         4.31638030e+01,   5.50976635e+00,   6.43186489e+00,
         3.67938576e+01,   1.27781198e+00,   5.34103557e+01,
         2.50228240e+01,   1.56507403e+01,   3.82924519e+00,
         2.40946421e+01,   1.25766503e+01,   1.28462051e+01,
         4.80637378e+01,   2.57279723e+01,   7.73622891e-01,
         1.12247008e+00,   3.33902606e+00,   5.32916877e+00,
         5.71730020e+00,   4.54590539e+01,   7.52087259e+01,
         6.49679662e+00,   5.44969403e+01,   9.92216169e+00,
         3.75101890e+00,   1.14472851e+01,   1.30472779e+01,
         2.14784472e+01,   2.48386788e+00,   1.75913820e+00,
         1.05551836e+01,   1.40993081e+01,   7.62059321e+00,
         4.58797667e+01,   3.71674432e+00,   2.29168270e+01,
         7.82131779e+00,   1.83846250e+00,   3.30690985e+01,
         7.39983786e+00,   1.90396539e+01,   3.25448987e+00,
         3.32775112e+01,   1.74368860e+00,   1.97344320e+01,
         1.10431661e+01,   2.83989068e+01,   1.46933917e+01,
         1.31643167e+00,   8.99148986e+00,   3.43202026e+01,
         1.78870310e+01,   7.82460256e+01,   2.40324226e+01,
         3.09731778e+01,   8.25825013e+01,   4.12612133e+01,
         1.07722530e+01,   1.25532757e+00,   2.72088941e+01,
         9.00075007e+00,   1.75860938e+01,   2.59423012e+00,
         4.85141553e+00,   6.83579777e+00,   6.71548160e+00,
         1.52727551e+01,   6.20074770e+00,   1.71621009e+01,
         2.26887931e+01,   1.50661753e+01,   1.88850089e+01,
         9.41778427e+00,   2.02236557e+01,   8.76416965e+00,
         2.96747763e+00,   5.66196680e+00,   3.98963895e+00,
         1.59421580e+00,   3.89531929e+01,   6.74923320e+00,
         8.92722790e+00,   9.27343255e+00,   1.44688828e+01,
         3.97976926e+01,   3.76026103e+01,   2.68872980e+01,
         1.36818470e+01,   9.91030317e+00,   9.55623343e-01,
         1.49919998e+01,   5.80355840e+00,   1.63296812e+01,
         2.22522395e+01,   5.13400903e+00,   4.07934249e+00,
         4.58409628e-01,   2.41344571e+01,   7.61698738e+00,
         1.68059718e+01,   6.25497910e+00,   1.09912255e+01,
         9.10054829e+00,   1.48131178e+01,   1.27562435e+01,
         4.83511573e+00,   1.39347890e+01,   3.49335754e+00,
         3.08703860e+01,   2.27022563e+01,   4.30027092e+00,
         6.13260552e+01,   1.32791001e+01,   5.91972524e-01,
         4.56634705e+01,   4.37329924e+00,   1.42913501e+01,
         3.14218484e+01,   1.37680235e+01,   3.65247818e+01,
         1.59729964e+01,   5.42017934e+00,   1.41940702e+00,
         4.88464900e+00,   1.13787467e+01,   1.15113999e+01,
         9.15541606e+00,   8.08593074e-01,   3.22792793e+00,
         4.48630679e+01,   3.29479354e+00,   2.82436566e+01,
         7.93390505e+00,   2.45088250e+01,   4.01083212e+00,
         4.63389503e+01,   5.19145235e+00,   3.39175402e+00,
         2.24434001e+00,   2.13123938e+00,   5.73178559e+00,
         1.49546471e+01,   7.37305478e+00,   1.59617207e+01,
         2.16326795e+01,   5.79075920e+00,   9.71214407e+00,
         4.14353419e+01,   3.14606932e+01,   6.63382511e+00,
         4.47763379e+01,   7.14795452e+00,   3.35370691e+01,
         3.68331674e+01,   1.61899827e+01,   5.29432206e+00,
         2.46497432e+00,   3.19357954e+01,   1.33450436e+01,
         1.49088721e+01,   6.20961839e+00,   1.89158055e+01,
         2.53505734e+01,   2.85446070e+00,   2.15012879e+01,
         6.10170512e+00,   3.39692890e+01,   3.03530829e+01,
         3.00425274e+01,   9.21046477e+00,   3.24077500e+01,
         1.29849039e+01,   2.12578267e+01,   1.46948201e+01,
         4.71266736e+00,   2.24023201e+00,   5.56431479e+00,
         1.15091179e+01,   1.83215910e+01,   4.92741227e+01,
         4.31024536e+00,   6.45922321e-01,   3.18321657e+01,
         3.63377154e+01,   1.02024272e+00,   1.44599366e+01,
         3.19589117e+00,   4.11561483e+01,   3.94175534e+00,
         1.16920622e+01,   2.11197029e+00,   1.46131582e+01,
         1.45519668e+01,   3.71712357e+00,   3.21647557e+01,
         1.66538690e+00,   9.48358990e+00,   1.07530889e+01,
         5.15227358e+00,   3.40842524e+00,   1.22519237e+01,
         5.54185383e+00,   5.37163175e+00,   1.62182908e+01,
         2.22469128e+01,   2.23463494e+01,   1.12238806e+01,
         2.61491454e+01,   8.40182478e+00,   3.67111959e+01,
         2.11014938e+01,   1.16608606e+01,   2.99422508e+00,
         4.88911363e+00,   2.81302035e+00,   1.52783221e+01,
         3.76270257e+01,   1.34707524e+01,   5.74602449e+00,
         3.78295302e+01,   2.52268330e+00,   2.04095957e+01,
         1.63240896e+01,   7.25071325e+00,   4.72630381e+01,
         1.31128268e+01,   2.71842199e+01,   6.20052389e+00,
         1.58835608e+00,   2.04790401e+01,   1.56542956e+01,
         1.20216465e+01,   1.33170939e+00,   1.42243732e+01,
         4.68960543e+01,   3.65555236e+01,   1.56928542e+01,
         2.35508450e+01,   3.78162142e+00,   5.86723030e+01,
         8.36047770e+00,   1.01697644e+01,   3.57720321e+00,
         1.68507150e+01,   2.10057546e+00,   8.01929716e-01,
         1.09514605e+01,   1.75297961e+00,   1.18418818e+01,
         1.29428132e+01,   2.97701253e+00,   7.96203264e+00,
         3.71675644e+01,   1.62403776e+01,   6.60138173e+00,
         2.75455613e+01,   9.33069496e+00,   1.34295169e+01,
         1.61032672e+01,   2.75142419e+01,   2.36779775e+01,
         3.87503353e+01,   4.53245660e+01,   1.93176232e-01,
         5.20120137e+00,   3.28611401e+01,   5.52151919e+00,
         2.67137791e+01,   1.38062344e+01,   1.42933552e+01,
         2.42136151e+01,   9.39695789e+00,   1.33417212e+01,
         5.23912612e+00,   2.72214799e+00,   4.49718157e-01,
         3.81993896e+00,   6.00123781e+01,   1.95226775e+00,
         3.43792018e+01,   2.08238562e+01,   4.21802729e+01,
         2.10072079e+01,   4.32900089e+00,   2.84072411e+01,
         1.71588460e+01,   5.63474681e+00,   1.57540393e+01,
         6.05307105e+00,   6.20793253e+00,   2.98942541e+00,
         1.04489820e+01,   8.40215616e+00,   4.18820006e+00,
         1.26690163e+01,   9.64717817e+00,   8.60141544e+00,
         3.22303121e+01,   6.34189023e+01,   1.16658630e+01,
         2.13696126e+01,   2.73441435e+01,   7.33833013e+00,
         6.73967621e+00,   6.57101352e+00,   8.75738787e+00,
         5.58373620e+00,   1.67959306e+01,   1.88429150e+01,
         3.73962485e+01,   2.19877980e+01,   2.36954153e+01,
         8.03297246e+01,   1.59706937e+00,   1.15540137e+01,
         5.31160364e+01,   1.89869083e+01,   6.71393053e-01,
         9.80262786e+00,   1.18447883e+01,   3.32466833e+00,
         5.19373359e-01,   1.21420742e+01,   6.00048368e+00,
         4.61562328e+01,   2.72127880e+00,   1.55047704e-01,
         4.76375942e+01,   2.97994970e+01,   1.01197277e+01,
         2.21635717e+00,   3.47828459e+01,   5.28646259e+00,
         5.25330515e+00,   2.39654035e+00,   1.68998607e+01,
         1.87762126e+00,   3.89580887e+01,   6.67198159e+00,
         4.91823602e+00,   8.48902466e-01,   1.84234295e+01,
         2.04888122e+01,   3.23629624e+01,   1.74045125e+01,
         3.48115573e+00,   1.95483387e+00,   3.54931372e+00,
         7.58885137e+00,   1.36432604e+01,   7.59330790e+00,
         1.79829021e+01,   3.16780470e+00,   3.21331163e+00,
         8.30664634e+00,   1.71600779e+00,   8.95779448e+00,
         1.65831703e+00,   3.21550559e+01,   5.95575722e-01,
         1.06321703e+01,   3.13511569e+00,   4.57460904e-01,
         2.85023361e+01,   4.93062308e+00,   5.76793309e+01,
         1.32880977e+01,   1.41866730e+01,   8.91606381e+01,
         1.98141847e+01,   4.81533697e+00,   1.49207533e+00,
         1.75646078e+01,   1.42701686e+01,   2.04397250e+01,
         9.79087094e+00,   4.39573893e+01,   8.00171852e+00,
         1.05385959e+01,   6.95677832e+00,   2.41947102e+01,
         5.61641645e+01,   1.12864145e+01,   3.23572332e+01,
         9.28833674e+00,   1.62448856e+01,   2.43632935e+00,
         2.72335887e+01,   1.93046740e+01,   5.95775200e+00,
         7.90997804e+00,   1.22196914e+01,   8.35421014e+00,
         4.52848290e+00,   1.17890950e+00,   2.95937242e+01,
         8.51230152e+00,   9.03896674e+00,   3.84033578e+01,
         9.60801712e+00,   1.31213311e+00,   6.38916566e+00,
         1.85585341e+01,   2.85748828e+00,   5.97036235e+00,
         4.24580729e-01,   8.18288387e+00,   8.74579468e-01,
         1.95835768e+01,   1.23316030e+01,   1.89609969e+01,
         7.89377831e-01,   1.13046222e+00,   6.21763159e-01,
         1.67537693e+01,   1.16168555e+00,   1.41213338e+01,
         4.06082010e+00,   2.69457235e+01,   8.76810392e+00,
         4.39284495e+01,   4.60068856e+00,   1.61806749e+01,
         1.22974186e+01,   2.66150399e+01,   2.96012461e+00,
         2.68307353e+01,   6.27703284e+00,   8.65049365e+00,
         1.49790459e+01,   7.25073674e+00,   2.03347554e+01,
         3.30635399e+00,   5.24974539e+00,   2.24414190e+01,
         8.80272130e+00,   1.33082782e+01,   1.50518840e+01,
         1.00217696e+01,   2.45953747e+01,   1.89942359e+01,
         4.81593731e+00,   1.88255875e+01,   7.95474009e+00,
         4.46870809e+00,   9.85694828e+00,   3.30629280e+01,
         7.30936714e+01,   1.06847479e+01,   1.53995699e+00,
         1.92282647e+01,   7.16134097e+00,   2.26106782e+01,
         1.07651843e+01])

In [29]:
import numpy
import matplotlib as mpl
from matplotlib import pyplot as plot
#matplotlib 모듈은 중앙집중식 구성으로 동작하는 rc객체를 갖는다.모든 맷플롯립 객체는 rc 객체의 기본 설정을 가져온다.
#rc객체는 속성 집합과 관련된 값을 담는다.
mpl.rc('lines', linewidth = 2.)#lines.linewidth속성의 기본값을 2로 설정
mpl.rc('axes', facecolor = 'k', edgecolor = 'w')
mpl.rc('xtick', color = 'w')
mpl.rc('ytick', color = 'w')
mpl.rc('text', color = 'w')
mpl.rc('figure', facecolor = 'k', edgecolor ='w')
mpl.rc('axes', color_cycle = ('w', '.5', '.75'))
mpl.rc('savefig', facecolor = 'k', edgecolor = 'w')
X = numpy.linspace(0, 7, 1024)

plot.plot(X, numpy.sin(X))
plot.plot(X, numpy.cos(X))
plot.show()


c:\users\gin22\miniconda3\envs\ml_python\lib\site-packages\matplotlib\__init__.py:913: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))

In [51]:
import numpy
import matplotlib.path as mpath
from matplotlib import pyplot as plot

shape_description = [
	( 1.,  2., mpath.Path.MOVETO),
	( 1.,  1., mpath.Path.LINETO),
	( 2.,  1., mpath.Path.LINETO),
	( 2., -1., mpath.Path.LINETO),
	( 1., -1., mpath.Path.LINETO),
  ( 1., -2., mpath.Path.LINETO),
	(-1., -2., mpath.Path.LINETO),
	(-1., -1., mpath.Path.LINETO),
	(-2., -1., mpath.Path.LINETO),
	(-2.,  1., mpath.Path.LINETO),
	(-1.,  1., mpath.Path.LINETO),
	(-1.,  2., mpath.Path.LINETO),
	( 0.,  0., mpath.Path.CLOSEPOLY),
]

u, v, codes = zip(*shape_description)
my_marker = mpath.Path(numpy.asarray((u, v)).T, codes)

data = numpy.random.rand(8, 8)
plot.scatter(data[:,0], data[:, 2], c = '.75', marker = my_marker, s = 400)
plot.show()
np.asarray((u,v)).T
data[:,1]


Out[51]:
array([  8.34333802e-02,   5.78733248e-01,   1.34170012e-01,
         9.82457948e-01,   3.03953586e-01,   7.99542393e-01,
         3.20158919e-01,   3.90449919e-04])

In [94]:
import matplotlib.pyplot as plt
plt.rcdefaults()

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.path as mpath
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
from matplotlib.collections import PatchCollection


def label(xy, text):
    y = xy[1] - 0.15  # shift y-value for label so that it's below the artist
    plt.text(xy[0], y, text, ha="center", family='sans-serif', size=14)


fig, ax = plt.subplots()
# create 3x3 grid to plot the artists
grid = np.mgrid[0.2:0.8:3j, 0.2:0.8:3j].reshape(2, -1).T

patches = []

# add a circle
circle = mpatches.Circle(grid[0], 0.1, ec="none")
patches.append(circle)
label(grid[0], "Circle")

# add a rectangle
rect = mpatches.Rectangle(grid[1] - [0.025, 0.05], 0.05, 0.1, ec="none")
patches.append(rect)
label(grid[1], "Rectangle")

# add a wedge
wedge = mpatches.Wedge(grid[2], 0.1, 30, 270, ec="none")
patches.append(wedge)
label(grid[2], "Wedge")

# add a Polygon
polygon = mpatches.RegularPolygon(grid[3], 5, 0.1)
patches.append(polygon)
label(grid[3], "Polygon")

# add an ellipse
ellipse = mpatches.Ellipse(grid[4], 0.2, 0.1)
patches.append(ellipse)
label(grid[4], "Ellipse")

# add an arrow
arrow = mpatches.Arrow(grid[5, 0] - 0.05, grid[5, 1] - 0.05, 0.1, 0.1, width=0.1)
patches.append(arrow)
label(grid[5], "Arrow")

# add a path patch
Path = mpath.Path
path_data = [
    (Path.MOVETO, [0.018, -0.11]),
    (Path.CURVE4, [-0.031, -0.051]),
    (Path.CURVE4, [-0.115,  0.073]),
    (Path.CURVE4, [-0.03 ,  0.073]),
    (Path.LINETO, [-0.011,  0.039]),
    (Path.CURVE4, [0.043,  0.121]),
    (Path.CURVE4, [0.075, -0.005]),
    (Path.CURVE4, [0.035, -0.027]),
    (Path.CLOSEPOLY, [0.018, -0.11])
    ]
codes, verts = zip(*path_data)
path = mpath.Path(verts + grid[6], codes)
patch = mpatches.PathPatch(path)
patches.append(patch)
label(grid[6], "PathPatch")

# add a fancy box
fancybox = mpatches.FancyBboxPatch(
    grid[7] - [0.025, 0.05], 0.05, 0.1,
    boxstyle=mpatches.BoxStyle("Round", pad=0.02))
patches.append(fancybox)
label(grid[7], "FancyBboxPatch")

# add a line
x, y = np.array([[-0.06, 0.0, 0.1], [0.05, -0.05, 0.05]])
line = mlines.Line2D(x + grid[8, 0], y + grid[8, 1], lw=5., alpha=0.3)
label(grid[8], "Line2D")

colors = np.linspace(0, 1, len(patches))
collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3)
collection.set_array(np.array(colors))
ax.add_collection(collection)
ax.add_line(line)

plt.subplots_adjust(left=0, right=1, bottom=0, top=1)
plt.axis('equal')
plt.axis('off')

plt.show()



In [ ]: