From dfb09b428ea799118843bd8ee0ba7f1ff5c82829 Mon Sep 17 00:00:00 2001 From: Emily Hunt Date: Sat, 18 Jan 2025 00:28:35 +0100 Subject: [PATCH] Add example maps, starting with 'sinepark' --- src/sk8plotlib/maps/__init__.py | 1 + src/sk8plotlib/maps/sinepark.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/sk8plotlib/maps/__init__.py create mode 100644 src/sk8plotlib/maps/sinepark.py diff --git a/src/sk8plotlib/maps/__init__.py b/src/sk8plotlib/maps/__init__.py new file mode 100644 index 0000000..0c4da65 --- /dev/null +++ b/src/sk8plotlib/maps/__init__.py @@ -0,0 +1 @@ +from .sinepark import sinepark diff --git a/src/sk8plotlib/maps/sinepark.py b/src/sk8plotlib/maps/sinepark.py new file mode 100644 index 0000000..8531440 --- /dev/null +++ b/src/sk8plotlib/maps/sinepark.py @@ -0,0 +1,18 @@ +import numpy as np +from matplotlib import pyplot as plt +from matplotlib.figure import Figure + + +def sinepark() -> Figure: + """Simple example map. Full o' sines.""" + + x = np.linspace(-np.pi, 50 * np.pi, num=1000) + y = np.cos(x) - x * 0.2 * np.cos(x) - 0.5*x + + x = x * 2 - 1 + y = y - 2 + y = y * 3 + + fig, ax = plt.subplots(figsize=(8, 4), dpi=300) + ax.plot(x, y) + return fig -- 2.54.0