loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.4009943342967819","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG51bXB5IGFzIG5wCmltcG9ydCBtYXRwbG90bGliLnB5cGxvdCBhcyBwbHQKCnggPSBucC5saW5zcGFjZSgwLCA0ICogbnAucGksIDEwMCkKeSA9IG5wLmFycmF5KFtucC5zaW4oeCArIG4pICogbiBmb3IgbiBpbiByYW5nZSgxLCA1KV0pCgpkZWYgZmFuY3lfdGl0bGVzKHQxLCB0MiwgYXg9Tm9uZSk6CiAgaWYgYXg6CiAgICBheC5zZXRfdGl0bGUodDEsIGxvYz0nbGVmdCcsIGZvbnRzaXplPTE4KQogICAgYXguc2V0X3RpdGxlKHQyLCBsb2M9J3JpZ2h0JywgZm9udHNpemU9MTMsIGNvbG9yPSdncmV5JykKICBlbHNlOgogICAgcGx0LnRpdGxlKHQxLCBsb2M9J2xlZnQnLCBmb250c2l6ZT0xOCkKICAgIHBsdC50aXRsZSh0MiwgbG9jPSdyaWdodCcsIGZvbnRzaXplPTEzLCBjb2xvcj0nZ3JleScpCgoKd2l0aCBwbHQuc3R5bGUuY29udGV4dCgnZ2dwbG90Jyk6CgogIHBsdC5wbG90KHgsIHkudHJhbnNwb3NlKCkpCgogIHBsdC54bGFiZWwoIngiKQogIHBsdC55bGFiZWwoIiRuIFxjZG90IFxzaW4gKHggKyBuKSQiKQogIGZhbmN5X3RpdGxlcygiQW4gQXNzb3J0bWVudCBvZiBXYXZlcyIsICJmb3IgJG4gPSAxIFxsZG90cyA0JCIpCgogIHBsdC5zYXZlZmlnKCJnZ3Bsb3QtdHJpZyIp"},"asBuffer":null},"loaded":true}}
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")