# Plot in matplotlib
import numpy as np
import matplotlib.pyplot as plt
from math import pi
x = np.linspace(-2.0*pi,2.0*pi,200)
plt.plot(x,np.sin(x))
samples=x[::2]
plt.plot(samples,np.sin(samples),'r*')
plt.title('Function sin(x) and some points plotted')
plt.grid()
plt.xlabel("x")
plt.ylabel("y")
plt.savefig('ex200.png', dpi=72)
plt.show()

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading