From f519fe8482a7cbcfd1a9caa006bc4e6781204040 Mon Sep 17 00:00:00 2001 From: DGrothe-PhD Date: Thu, 27 Mar 2025 18:05:08 +0100 Subject: [PATCH] plot mathematical curves, for example lissajous figure like a flower --- plots/plot_flower_with_python.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 plots/plot_flower_with_python.py diff --git a/plots/plot_flower_with_python.py b/plots/plot_flower_with_python.py new file mode 100644 index 0000000..d80af97 --- /dev/null +++ b/plots/plot_flower_with_python.py @@ -0,0 +1,20 @@ +import matplotlib.pyplot as plt +import math +import numpy as np + +# set things +t = np.linspace(0, 75.4, 5000, endpoint = False) +x = [] +y = [] +for k in t: + x_i = (3*np.cos(k)+2)*np.cos(k/12) - np.sin(k)*np.sin(k/12) + y_i = (3*np.cos(k)+2)*np.sin(k/12) + np.sin(k)*np.cos(k/12) + x.append(x_i) + y.append(y_i) + +# plot the graph +plt.plot(x,y) +plt.title('Nice plot') +Text(0.5, 1.0, 'Nice plot') + +plt.show()