Skip to content

Instantly share code, notes, and snippets.

@rhoit
Created November 20, 2020 04:37
Show Gist options
  • Save rhoit/c77b85432c81bda94a5acf0b6768dc98 to your computer and use it in GitHub Desktop.
Save rhoit/c77b85432c81bda94a5acf0b6768dc98 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
n = 100
x = np.arange(n)
plt.plot(x, x, label='linear')
plt.plot(x, 2*x, label='double')
plt.plot(x, x*x, label='square')
plt.plot(x, x**3, label='power')
plt.grid()
plt.xlim(0, n)
plt.ylim(0, n)
plt.legend()
plt.savefig('./plt/function.png')
plt.show()
return './plt/function.png'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment