From 218406e41bcbb14078c188b93a48cb9655d6d6b6 Mon Sep 17 00:00:00 2001 From: Lukas Gienapp Date: Tue, 9 Aug 2022 11:21:13 +0200 Subject: [PATCH] Add example plotting function --- aquarel/utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/aquarel/utils.py b/aquarel/utils.py index 3ac6cb7..ba002cd 100644 --- a/aquarel/utils.py +++ b/aquarel/utils.py @@ -37,3 +37,22 @@ def _get_themes(): glob.glob(f"{loc}/themes/*.json"), ) ) + +def make_samples(): + """ + Generates sample plots for all themes to be used in documentation + """ + import numpy as np + import matplotlib.pyplot as plt + for theme in list_themes(): + with load_theme(theme): + fig, ax = plt.subplots(1, 1) + x = np.linspace(0.0, 4.0) + plt.plot(x, np.cos(2 * np.pi * x) * np.exp(-x)) + plt.plot(x, np.sin(2 * np.pi * x) * np.exp(-x)) + plt.plot(x, np.sin(2 * np.pi * x) * np.log(x)) + ax.set_title(theme) + ax.set_xlabel("X-Axis") + ax.set_ylabel("Y-Axis") + fig.savefig(f"assets/{theme}.png", dpi=75, transparent=False, facecolor=fig.get_facecolor(), + bbox_inches='tight') \ No newline at end of file