#!/usr/bin/env python

"""
simple test of quiver plot
"""

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np


x = (1,2)
y = (1,2)
u = (2,2)
v = (-2,2)


fig = plt.figure(1)
fig.clear()

ax = fig.add_subplot(2,2,1)

props = {'units' : "dots",
         'angles': 'uv',
         'scale' : .1,
         'width' : 2,
         'headwidth': 2,
         'headlength': 3,
         'headaxislength': 4,
         }

ax.quiver( x, y, u, v, **props )
ax.set_xlim((0, 4))
ax.set_ylim((0, 4))


ax = fig.add_subplot(2,2,2)
##NOTE: length is changing with change in "units"
props = {'units' : "inches",
         'angles': 'uv',
         'scale' : .1,
         'width' : .02,
         'headwidth': .02,
         'headlength': .03,
         'headaxislength': .04,
         }

ax.quiver( x, y, u, v, **props )
ax.set_xlim((0, 4))
ax.set_ylim((0, 4))


ax = fig.add_subplot(2,2,3)

## this crashes if I uncomment the angles setting
props = {'units' : "dots",
         'angles': (0.0, 90.0),
         'scale' : .1,
         'width' : 2,
         'headwidth': 2,
         'headlength': 3,
         'headaxislength': 4,
         }

ax.quiver( x, y, u, v, **props )
ax.set_xlim((0, 4))
ax.set_ylim((0, 4))




plt.draw()
plt.show()