Example #1
0
matplotlib.rcParams['legend.fancybox'] = True
import matplotlib.pyplot as plt

fontsize = 20
labelsize = 13.5

def fix_axis_labels(plt):
    plt.tick_params(labelsize=labelsize)
    plt.xticks((1, 10, 100), ('1', '10', '100'))
    plt.yticks((1, 1e-4, 1e-8, 1e-12),
               ('1e0', '1e-4', '1e-8', '1e-12'))
    plt.axis([.9, 111, 1e-13, 10])

plt.figure()
ax = plt.subplot(1, 1, 1)
size, L = dec.get_data(dataname)
ax.loglog(size, L[0], '-o', color='r', label='Primal')
ax.loglog(size, L[1], '-s', color='b', label='Dual')
ax.grid(True)
ax.legend(shadow=True, fancybox=True)
#plt.title(r'Chebyshev 0-forms')
plt.xlabel(r'$N$', fontsize=fontsize)
plt.ylabel(r'$\parallel \Delta f - q \parallel_\infty$', fontsize=fontsize)
fix_axis_labels(plt)
#plt.savefig("Documents/Research/Desbrun/latex/SpectralDEC/plot/cheb/poisson2d_cheb_00.pdf")

plt.figure()
ax = plt.subplot(1, 1, 1)
ax.loglog(size, L[2], '-o', color='r', label='Primal')
ax.loglog(size, L[3], '-s', color='b', label='Dual')
ax.grid(True)
Example #2
0
    def vec(X, Y):
        U = 0
        V = 0
        for _f, _b in zip(flat(f), flat(g.B1)):
            u, v = _b(X, Y)
            U += _f*u
            V += _f*v
        return U, V

    X = linspace(-1, +1, 2*N-1)
    Y = linspace(-1, +1, 2*N-1)
    X, Y = meshgrid(X, Y)
    U, V = vec(X, Y)
    return g.verts, X, Y, U, V

dataname = "converge/poisson_2d_example.json"
#dec.store_data(dataname, run())

import matplotlib
from matplotlib.pyplot import *
matplotlib.rcParams['legend.fancybox'] = True
import matplotlib.pyplot as plt

verts, X, Y, U, V = dec.get_data(dataname)
scatter(*verts)
quiver(X, Y, U, V)

show()