Matplotlib
It's important to learn to use libraries properly
Use local docs or use online docs , elevate your programming skills
Ever since I learned of the existence of matplotlib I knew I had another nice task set to have fun programming & keep me busy for a nice while
src.py
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery')
# make data
x = np.linspace(0, 10, 100)
y = 4 + 1 * np.sin(2 * x)
x2 = np.linspace(0, 10, 25)
y2 = 4 + 1 * np.sin(2 * x2)
# plot
fig, ax = plt.subplots()
ax.plot(x2, y2 + 2.5, 'x', markeredgewidth=2)
ax.plot(x, y, linewidth=2.0)
ax.plot(x2, y2 - 2.5, 'o-', linewidth=2)
ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
ylim=(0, 8), yticks=np.arange(1, 8))
plt.show()
A gorgeous mathematical function is plotted when you run the program. I don't want to make screencaps now, use the link to see the output I got.
I use the featherweight geany on the SBC Pi5, you choose which IDE you like.
Yes vim is a superb source code editor. The syntax highlighting is sublime!
Sources
https://geany.org/
https://matplotlib.org/stable/plot_types/index.html
https://matplotlib.org/stable/plot_types/basic/plot.html
#python #programming #python #libraries #matplotlib #API #mathematics #SBC #Pi5 #arm #arm64 #x86 #Linux #OpenSource