Example #1
0
ax1.text(0.,
         1.05,
         'y',
         size=20,
         transform=BlendedGenericTransform(ax1.transData, ax1.transAxes))
ax1.text(1.05,
         -0.15,
         'x',
         size=20,
         transform=BlendedGenericTransform(ax1.transAxes, ax1.transData))

vec_phi_xy = ax1.quiver(0,
                        0,
                        0,
                        0,
                        width=10,
                        scale=1,
                        units='x',
                        label=r'$\phi_n$',
                        color='b')
vec_Snn_xy = ax1.quiver(0,
                        0,
                        0,
                        0,
                        width=6,
                        scale=1,
                        units='x',
                        label=r'$\sigma_{nn}$',
                        color='c')
vec_Snt_xy = ax1.quiver(0,
                        0,
Example #2
0
g = orig + acceleration

print h, x, g

soa = np.array([h, x, g])  # vectors
print soa
X, Y, U, V = zip(*soa)  # convert to turples of U and V components

fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
colors = ('r', 'g', 'b')
qv = ax.quiver(X,
               Y,
               U,
               V,
               color=colors,
               angles='xy',
               scale_units='xy',
               scale=1)

labels = ('heading: {} deg'.format(hdeg),
          'Orientation, drift: {} deg'.format(drift),
          '{} g at {} deg'.format(aforce, adeg))
pos = ('N', 'E', 'S')
for x, y, l, c, p in zip(U, V, labels, colors, pos):
    plt.quiverkey(qv, x, y, 0, l, color=c, coordinates='data', labelpos=p)

ax.set_xlim([-2, 2])
ax.set_ylim([-2, 2])

# show cartisian axis
Example #3
0
ic = [[0.2, 0.2], [0.2, -0.2], [0.2, -0.5], [0.2, 0.7]]
color = ['r', 'b', 'g', 'y']

for direction in ["xzero", "yzero"]:
    ax.axis[direction].set_axisline_style("-|>")
    ax.axis[direction].set_visible(True)
for k in range(len(ic)):
    Y = []
    T = []
    S = []
    r.set_initial_value(ic[k], t0).set_f_params()
    while r.successful() and r.t + dt < tEnd:
        r.integrate(r.t + dt)
        Y.append(r.y)

    S = np.array(np.real(Y))
    ax.plot(S[:, 0], S[:, 1], color=color[k], lw=1.25)

X, Y = np.meshgrid(np.linspace(-5, 5, 40), np.linspace(-5, 5, 20))
U = 1
V = X / Y

N = np.sqrt(U**2 + V**2)
U2, V2 = U / N, V / N
ax.quiver(X, Y, U2, V2)

plt.xlim([-5, 5])
plt.ylim([-5, 5])
plt.ylabel(r"$y$")
plt.show()
Example #4
0
h = orig + heading # normalized heading
x = orig + orientation # normalized orientation
g = orig + acceleration

print h,x,g

soa = np.array([h,x,g]) # vectors
print soa
X,Y,U,V = zip(*soa) # convert to turples of U and V components

fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
colors = ('r','g','b')
qv = ax.quiver(X,Y,U,V,color=colors,angles='xy',scale_units='xy',scale=1)

labels = ('heading: {} deg'.format(hdeg), 'Orientation, drift: {} deg'.format(drift), '{} g at {} deg'.format(aforce,adeg))
pos = ('N','E','S')
for x,y,l,c,p in zip(U,V,labels,colors,pos):
	plt.quiverkey(qv,x,y,0,l,color=c,coordinates='data',labelpos=p)

ax.set_xlim([-2,2])
ax.set_ylim([-2,2])

# show cartisian axis
# for direction in ["xzero", "yzero"]:
#     ax.axis[direction].set_visible(True)

# turn off side axis
for direction in ["left", "right", "bottom", "top"]:
Example #5
0
from mpl_toolkits.axes_grid.axislines import SubplotZero
from matplotlib import colors

roll = 15
pitch = 5

orig = [0, 0]

X, Y = (0, 0)  # origin
U = roll
V = pitch

fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
qv = ax.quiver(X, Y, U, V, color="y", angles="xy", scale_units="xy", scale=1)

ax.set_xlim([-45, 45])
ax.set_ylim([-45, 45])

# show cartisian axis
for direction in ["xzero", "yzero"]:
    ax.axis[direction].set_visible(True)

# turn off side axis
# for direction in ["left", "right", "bottom", "top"]:
#     ax.axis[direction].set_visible(False)

plt.draw()
plt.show()