In [1]:
%matplotlib inline

In [2]:
import numpy as np
import matplotlib.pyplot as plt

In [3]:
plt.rcParams['figure.figsize'] = (12, 10)

In [4]:
x = np.mgrid[0.0:2*np.pi:3000j]

In [5]:
y0 = np.sin(x)

In [6]:
plt.plot(x, y0, '-k.', label="all points")
plt.xlabel("x")
plt.ylabel("y")
plt.legend()


Out[6]:
<matplotlib.legend.Legend at 0x7f93dc5fd898>

In [7]:
for i, sample_step in enumerate([1, 5, 50, 500]):
    plt.subplot(2, 2, i+1)
    plt.plot(x[::sample_step], y0[::sample_step], '.-')
    plt.title("Step Size {}".format(sample_step))



In [8]:
for i, sample_size in enumerate([5, 50, 100, 500]):
    plt.subplot(2, 2, i+1)
    ind = np.random.choice(np.arange(x.size), sample_size)
    ind.sort()
    plt.plot(x[ind], y0[ind], '.-')
    plt.title("Random {}".format(sample_size))



In [9]:
x = np.mgrid[0.0:20*np.pi:3000j]
y0 = np.sin(x)
plt.plot(x, y0, '-k.', label="all points")
plt.xlabel("x")
plt.ylabel("y")
plt.legend()


Out[9]:
<matplotlib.legend.Legend at 0x7f93b88cd080>

In [10]:
for i, sample_step in enumerate([1, 5, 50, 500]):
    plt.subplot(2, 2, i+1)
    plt.plot(x[::sample_step], y0[::sample_step], '.-')
    plt.title("Step Size {}".format(sample_step))



In [11]:
for i, sample_size in enumerate([5, 50, 100, 500]):
    plt.subplot(2, 2, i+1)
    ind = np.random.choice(np.arange(x.size), sample_size)
    ind.sort()
    plt.plot(x[ind], y0[ind], '.-')
    plt.title("Random {}".format(sample_size))



In [ ]: