loading
open in
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 4 * np.pi, 100)
y = np.array([np.sin(x + n) * n for n in range(1, 5)])

def fancy_titles(t1, t2, ax=None):
  if ax:
    ax.set_title(t1, loc='left', fontsize=18)
    ax.set_title(t2, loc='right', fontsize=13, color='grey')
  else:
    plt.title(t1, loc='left', fontsize=18)
    plt.title(t2, loc='right', fontsize=13, color='grey')


with plt.style.context('ggplot'):

  plt.plot(x, y.transpose())

  plt.xlabel("x")
  plt.ylabel("$n \cdot \sin (x + n)$")
  fancy_titles("An Assortment of Waves", "for $n = 1 \ldots 4$")

  plt.savefig("ggplot-trig")