Example #1
0
    newax, axis, axeq, hold, grid, gridhold

def myfun(x):
    return x[0,:]**2 +x[1,:]**3

domain = [0, 1,0, 2]
resolution = [20, 30]

q = dom2vec(domain, resolution)

f = myfun(q)

ax, fig = newax(1, dim=[3])
surf(q, f, resolution, ax=ax)

axis(ax, domain +[0, 10])
axeq(ax)

"""manage multiple axes"""
ax2, fig = newax(1, dim=[3])
surf(q, -f, resolution, ax=ax2)

axs =[ax, ax2]

hold(axs)
grid(axs)

# shorthand for above
gridhold(ax)

# uncomment these if outside ipython
Example #2
0
A = np.array([[1, -2, 3],
              [2, 1, 4],
              [9, 3, -3] ])
v = A.dot(x)

#quiver(x, v)

"""
tex 2d
"""
ax, fig = newax(2, dim=[2, 3])

x = np.array([[1, 1]]).transpose()
text(x, 'hehe 2d', ax[0])

limits = [0.5, 2, 0.5, 1.5]
ax[0].axis(limits)

"""
text 3d
"""
x = np.array([[1, 1, 2]]).transpose()
text(x, 'hehe 3d', ax[1])

limits = [0, 2, 0, 2, 1, 3]
axis(ax[1], limits)

# uncomment these if outside ipython
#from matplotlib import pylab as plt
#plt.show(block=True)