Plotting results - Nori12/Machine-Learning-Tutorial GitHub Wiki
Machine Learning Tutorial
Plotting results
Use the code below as a template for the plot. Remove the unnecessary features.
import matplotlib.pyplot as plt
import numpy as np
import math
line = np.linspace(0, 2*math.pi, 25).reshape(-1, 1)
fig, axes = plt.subplots(1, 2, figsize=(15, 4))
for omega, ax in zip([1, 2], axes):
sine = np.sin(omega * line)
ax.plot(line, sine)
indexes = (sine <= 0.15) & (sine >= -0.15)
ax.plot(line[indexes], sine[indexes], '*', markersize=8)
ax.set_title("Put the title here")
ax.set_xlabel("Time")
ax.set_ylabel("Value")
axes[0].legend(["Sine", "Zeros of sine"], loc="best")