Skip to content

Instantly share code, notes, and snippets.

@jColeChanged
Created June 27, 2013 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jColeChanged/5878244 to your computer and use it in GitHub Desktop.
Save jColeChanged/5878244 to your computer and use it in GitHub Desktop.
# -*- 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