Answers for "Broadcasting with NumPy Arrays Plotting a two-dimensional function Example"

0

Broadcasting with NumPy Arrays Plotting a two-dimensional function Example

# welcome to softhunt.net
import numpy as np
import matplotlib.pyplot as plt

# Computes x and y coordinates for
# points on sine and cosine curves
x = np.arange(0, 3 * np.pi, 0.1)
y_sin = np.sin(x)
y_cos = np.cos(x)

# Plot the points using matplotlib
plt.plot(x, y_sin)
plt.plot(x, y_cos)
plt.xlabel('x axis label')
plt.ylabel('y axis label')
plt.title('Sine and Cosine')
plt.legend(['Sine', 'Cosine'])

plt.show()
Posted by: Guest on April-21-2022

Code answers related to "Broadcasting with NumPy Arrays Plotting a two-dimensional function Example"

Python Answers by Framework

Browse Popular Code Answers by Language