Created
February 5, 2017 18:54
-
-
Save aunyks/44648b839e7c59b47afecca62c9a88de to your computer and use it in GitHub Desktop.
A Python program for graphing functions, plotting, points, etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Plz show the graph