Skip to content

Instantly share code, notes, and snippets.

@aunyks
Created February 5, 2017 18:54
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save aunyks/44648b839e7c59b47afecca62c9a88de to your computer and use it in GitHub Desktop.
Save aunyks/44648b839e7c59b47afecca62c9a88de to your computer and use it in GitHub Desktop.
A Python program for graphing functions, plotting, points, etc.
import matplotlib.pyplot as plt
import numpy as np
## Create functions and set domain length
x = np.arange(0.0, 2.0, 0.01)
y = x**2
dy = 2*x - 1
## Plot functions and a point where they intersect
plt.plot(x, y)
plt.plot(x, dy)
plt.plot(1, 1, 'or')
## Config the graph
plt.title('A Cool Graph')
plt.xlabel('X')
plt.ylabel('Y')
#plt.ylim([0, 4])
plt.grid(True)
plt.legend(['y = x^2', 'y = 2x'], loc='upper left')
## Show the graph
plt.show()
@pallaviwalke
Copy link

Plz show the graph

@manimanish2019
Copy link

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment