Created
June 27, 2013 17:04
-
-
Save jColeChanged/5878244 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
Created on Thu Jun 27 09:46:27 2013 | |
@author: joshua | |
""" | |
import matplotlib.pyplot as plt | |
vectors = [[1, 2], [3, 4], [-2, -4]] | |
xmin = 0 | |
xmax = 10 | |
ymin = 0 | |
ymax = 10 | |
plt.ylim((ymin, ymax)) | |
plt.xlim((xmin, xmax)) | |
ax = plt.axes() | |
plt.grid(ax) | |
def visual_addition(vectors): | |
x = 0 | |
y = 0 | |
for v in vectors: | |
plt.arrow(x, y, v[0], v[1], head_width=0.1, head_length=0.1) | |
x += v[0] | |
y += v[1] | |
plt.show() | |
visual_addition(vectors) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment