I would just like to plot perpendicular vectors in 2D. I implemented two ways to build them in the code below, but the vectors do not โlookโ perpendicular to me when the graphs are drawn. If that matters, I use Spyder.
import numpy as np import matplotlib.pyplot as plt x1=[0,0,4,3] x2=[0,0,-3,4] x3=[0,0,3,-4] soa =np.array([x1,x2,x3]) X,Y,U,V = zip(*soa) plt.figure() ax = plt.gca() ax.quiver(X,Y,U,V,angles='xy',scale_units='xy',scale=1) ax.set_xlim([-10,10]) ax.set_ylim([-10,10]) plt.draw() plt.show() import pylab as pl from matplotlib import collections as mc lines = [[(0, 1), (4, 3)], [(-3, 4), (3, -4)]] c = np.array([(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1)]) lc = mc.LineCollection(lines, colors=c, linewidths=2) fig, ax = pl.subplots() ax.add_collection(lc) ax.autoscale() ax.margins(0.1)