Skip to content

Commit

Permalink
Add example plotting function
Browse files Browse the repository at this point in the history
  • Loading branch information
lgienapp committed Aug 9, 2022
1 parent 143912c commit 218406e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions aquarel/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 218406e

Please sign in to comment.