Create scatter plot for square and cube of numbers with matplotlib

import numpy as np import matplotlib.pyplot as plt x = np.random.uniform(-4, 5, size=50) y = np.square(x) z = np.power(x,3) print(z) #Create scatter plot plt.scatter(x, y, label='Square') plt.scatter(x, z, label='Cube') plt.legend(loc=0) plt.show()

Similar Articles