def vedoPlotter(pygmsh_ms): # Reading mesh data stored in .xdmf files. mesh = Mesh() with XDMFFile(pygmsh_ms) as infile: infile.read(mesh) # Define variational problem V = FunctionSpace(mesh, 'P', 1) u = Function(V) R_path = "Output_data" fU_in = XDMFFile(os.path.join(R_path, 'FuelRod_m.xdmf')) fU_in.read_checkpoint(u, "T", 0) axes_opts = dict( xyGrid=True, axesLineWidth=1, xTickColor='black', yTickColor='black', xMinorTicks=1, # number of minor ticks btw two major ticks yMinorTicks=1, # number of minor ticks btw two major ticks xLabelSize=0.02, # size of the numeric labels along axis yLabelSize=0.02, # offset of numeric labels ) # nipy_spectral, gnuplot plot(u, interactive=True, cmap='hot', axes=0, lw=2, scalarbar='vertical', wireframe=True, alpha=10., warpZfactor=0.) # warpZfactor=0.01 plot()
solver.parameters["linear_solver"] = "lu" solver.parameters["convergence_criterion"] = "incremental" solver.parameters["relative_tolerance"] = 1e-6 # Step in time from vedo.dolfin import plot t = 0 T = 10*dt scalarbar = False while t < T: t += dt u0.vector()[:] = u.vector() solver.solve(problem, u.vector()) if t==T: scalarbar = 'horizontal' plot(u.split()[0], z=t*2e4, add=True, # do not clear the canvas style=0, lw=0, scalarbar=scalarbar, elevation=-3, # move camera a bit azimuth=1, text='time: '+str(t*2e4), lighting='plastic', interactive=0 ) plot()
from dolfin import * mesh = Mesh() editor = MeshEditor() editor.open(mesh, "triangle", 2, 2) editor.init_vertices(3) editor.add_vertex(0, [-1, 0]) editor.add_vertex(1, [ 1, 0]) editor.add_vertex(2, [ 0, 1]) editor.init_cells(1) editor.add_cell(0, [0, 1, 2]) editor.close() mesh.init() W = FunctionSpace(mesh, "BDM", 1) v = Expression(("0", "x[0]*x[0]"), degree=2) vi = interpolate(v, W) from vedo.dolfin import plot plot(vi, scalarbar="horizontal", style="meshlab")
u2 = project(exp(x[0]), V) class MyExpression(UserExpression): def __init__(self,u1,u2,**kwargs): self.u1 = u1 self.u2 = u2 super().__init__(**kwargs) def eval(self, values, x): values[0] = self.u1(x)/self.u2(x) def value_shape(self): return () f0 = MyExpression(u1, u2, degree=1) plot( interpolate(f0,V), warpYfactor=0.5, # y-scaling factor to solution lc='navy', # line color and width lw=3, xtitle="time [sec]", ytitle="velocity [a.u.]", axes={'xyGrid':True, 'xyPlaneColor':'blue', 'xyGridColor':'peru', 'xyAlpha':0.1, 'yHighlightZero':True, }, scalarbar=False, zoom=1.1, ) #screenshot('pic.png') # uncomment to take a screenshot
w = TrialFunction(V) v = TestFunction(V) u = Function(V) f = Constant(-6.0) # Compute solution solve(dot(grad(w), grad(v)) * dx == f * v * dx, u, bc) f = r'-\nabla^{2} u=f' ########################################################### vedo from vedo.dolfin import plot, Latex, clear, show l = Latex(f, s=0.2, c='w').addPos(.6, .6, .1) acts = plot(u, l, cmap='jet', scalarbar='h', returnActorsNoShow=True) actor = acts[0] solution = actor.pointdata[0] print('ArrayNames', actor.pointdata.keys()) print('min', 'mean', 'max:') print(np.min(solution), np.mean(solution), np.max(solution), len(solution)) assert np.isclose(np.min(solution), 1., atol=1e-03) assert np.isclose(np.mean(solution), 2.0625, atol=1e-03) assert np.isclose(np.max(solution), 4., atol=1e-03) assert len(solution) == 81 print('Test poisson PASSED')
''' compute_collision() will compute the collision of all the entities with a Point while compute_first_collision() will always return its first entry. Especially if a point is on an element edge this can be tricky. You may also want to compare with the Cell.contains(Point) tool. ''' # Script by Rudy at https://fenicsproject.discourse.group/t/ # any-function-to-determine-if-the-point-is-in-the-mesh/275/3 import dolfin from vedo.dolfin import plot from vedo import printc, pointcloud n = 4 Px = 0.5 Py = 0.5 mesh = dolfin.UnitSquareMesh(n, n) bbt = mesh.bounding_box_tree() collisions = bbt.compute_collisions(dolfin.Point(Px, Py)) collisions1st = bbt.compute_first_entity_collision(dolfin.Point(Px, Py)) printc("collisions : ", collisions) printc("collisions 1st: ", collisions1st) for cell in dolfin.cells(mesh): contains = cell.contains(dolfin.Point(Px, Py)) printc("Cell", cell.index(), "contains P:", contains, c=contains) ########################################### pt = pointcloud.Point([Px, Py], c='blue') plot(mesh, pt, text=__doc__)
G = BoundarySource(mesh, degree=2) # Define essential boundary def boundary(x): return x[1] < DOLFIN_EPS or x[1] > 1.0 - DOLFIN_EPS bc = DirichletBC(W.sub(0), G, boundary) # Compute solution w = Function(W) solve(a == L, w, bc) (sigma, u) = w.split() ########################################################### vedo from vedo.dolfin import plot, Text3D # Plot solution on mesh, and warp z-axis by the scalar value plot(u, warpZfactor=0.8, legend='u', text=__doc__) # # Plot the sigma vector on the mesh. Try also mode='arrows' # msg = Text3D("> plot(sigma, mode='mesh lines', warpZfactor= -0.2)", c='w') # plot(sigma, msg, # mode='mesh lines', # warpZfactor=-0.2, # rise mesh in z based on scalar value # scale=0.03, # scale the lines or arrows # new=True, # new window # )
"""#Control scalar bar range. > plot(u, mode='color', vmin=-3, vmax=3, style=1) Available styles: 0. vtk 1. matplotlib 2. meshlab 3. paraview 4. bw """ from dolfin import * mesh = UnitSquareMesh(16, 16) V = FunctionSpace(mesh, 'Lagrange', 1) f = Expression('10*(x[0]+x[1]-1)', degree=1) u = interpolate(f, V) ################################## vedo from vedo.dolfin import plot plot(u, mode='color', vmin=-3, vmax=3, style=1, text=__doc__)
A_z = TrialFunction(V) v = TestFunction(V) a = (1 / mu) * dot(grad(A_z), grad(v)) * dx L_N = sum(J_N * v * dx(i) for i in range(2, 2 + n)) L_S = sum(J_S * v * dx(i) for i in range(2 + n, 2 + 2 * n)) L = L_N + L_S # Solve variational problem A_z = Function(V) solve(a == L, A_z, bc) # Compute magnetic field (B = curl A) W = VectorFunctionSpace(mesh, 'P', 1) B = project(as_vector((A_z.dx(1), -A_z.dx(0))), W) # Plot solution from vedo.dolfin import plot plot( A_z, at=0, N=2, # draw on the first of 2 renderers lw=0, # linewidth of mesh isolines={ 'n': 20, 'lw': 1.5, 'c': 'black' }, scalarbar=False, ) plot(B, at=1, scalarbar=False, text=__doc__) # draw on the second renderer
[bc.apply(A1, b1) for bc in bcu] solve(A1, u1.vector(), b1, "bicgstab", "default") # Pressure correction b2 = assemble(L2) [bc.apply(A2, b2) for bc in bcp] [bc.apply(p1.vector()) for bc in bcp] solve(A2, p1.vector(), b2, "bicgstab", prec) # Velocity correction b3 = assemble(L3) [bc.apply(A3, b3) for bc in bcu] solve(A3, u1.vector(), b3, "bicgstab", "default") # Move to next time step u0.assign(u1) t += dt # Plot solution plot( u1, mode='mesh and arrows', text="Velocity of fluid", cmap='jet', scale=0.3, # unit conversion factor scalarbar=False, interactive=False) pb.print() plot()
""" Visualize a Fenics/dolfin mesh. Select mesh and press X to slice it. """ import dolfin from vedo.dolfin import plot, download fpath = download("https://vedo.embl.es/examples/data/dolfin_fine.xml") mesh1 = dolfin.Mesh(fpath) plot(mesh1) # show another light-green mesh in a new plotter window, # show file header too as an additional text comment mesh2 = dolfin.UnitCubeMesh(8, 8, 8) plot(mesh2, text=__doc__, color='lg', new=True)
solve(A2, p_.vector(), b2, 'bicgstab', 'hypre_amg') # Step 3: Velocity correction step b3 = assemble(L3) solve(A3, u_.vector(), b3, 'cg', 'sor') # Save solution to file (XDMF/HDF5) xdmffile_u.write(u_, t) xdmffile_p.write(p_, t) # Save nodal values to file timeseries_u.store(u_.vector(), t) timeseries_p.store(p_.vector(), t) # Update previous solution u_n.assign(u_) p_n.assign(p_) # Update progress bar print('n:',n) # Plot solution plot(u_, cmap='bone', text=__doc__, axes=0, # no axes scalarbar='h', interactive=False) plot()
"scale*(z0 + (x[1]-y0)*sin(theta) + (x[2]-z0)*cos(theta)-x[2])", ), scale=0.5, y0=0.5, z0=0.5, theta=pi / 4, degree=2) bcl = DirichletBC(V, c, left) bcr = DirichletBC(V, r, right) w = TrialFunction(V) # Incremental displacement v = TestFunction(V) # Test function u = Function(V) # Solution solve(inner(grad(w), grad(v)) * dx == inner(c, v) * dx, u, [bcl, bcr]) ########################################################### vedo from vedo.dolfin import plot, printc, exportWindow # print out some funny text printc("""~idea Try out plot options: ~pin color='gold' ~pin alpha=0.2, depthpeeling=True ~pin mode='mesh warp lines', lw=.05""", c='blue') plot(u, mode='my displaced mesh please!!', azimuth=45) #exportWindow('ex06_elasticity2.x3d') printc('~smile Thanks for using vedo!', c='green')
# Define variational problem u = TrialFunction(V) v = TestFunction(V) f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=1) g = Expression("sin(5*x[0])", degree=1) a = inner(grad(u), grad(v))*dx() L = f*v*dx() + g*v*ds() # Define function for the solution u = Function(V) # Define goal functional (quantity of interest) M = u*dx() # Define error tolerance tol = 1.e-5 problem = LinearVariationalProblem(a, L, u, bc) solver = AdaptiveLinearVariationalSolver(problem, M) solver.parameters["error_control"]["dual_variational_solver"]["linear_solver"] = "cg" solver.parameters["error_control"]["dual_variational_solver"]["symmetric"] = True solver.solve(tol) solver.summary() from vedo.dolfin import plot # Plot on 2 synced renderers plot(u.root_node(), at=0, N=2) plot(u.leaf_node(), at=1, text='final mesh', interactive=True)
# Define variational problem u = TrialFunction(V) v = TestFunction(V) f = Constant(0) F = u * v * dx + dt * dot(grad(u), grad(v)) * dx - (u_n + dt * f) * v * dx a, L = lhs(F), rhs(F) ############################################################# vedo from vedo.dolfin import plot, Latex f = r'\frac{\partial u}{\partial t}=\nabla^2 u+f~\mathrm{in}~\Omega\times(0,T]' formula = Latex(f, pos=(-.4, -.8, .1), s=0.6, c='w') formula.crop(0.2, 0.4) # crop top and bottom 20% and 40% # Time-stepping u = Function(V) for n in range(num_steps): # Compute solution solve(a == L, u, bc) # Plot solution plot(u, formula, scalarbar=False, interactive=False) # Update previous solution u_n.assign(u) plot()
img = plt.imread(datadir + "images/embl_logo.jpg") print('Image shape is', img.shape) img = img[:, :, 1] Nx, Ny = img.shape mesh = RectangleMesh(Point(0, 0, 0), Point(Ny * scale, Nx * scale, 1), Ny, Nx) class FE_image(UserExpression): def eval_cell(self, value, x, ufc_cell): p = Cell(mesh, ufc_cell.index).midpoint() i, j = int(p[1] / scale), int(p[0] / scale) value[:] = img[-(i + 1), j] def value_shape(self): return () y = FE_image() V = FunctionSpace(mesh, 'Lagrange', 1) u = Function(V) u.interpolate(y) cam = dict(pos=(10.6, 3.71, 22.7), focalPoint=(10.6, 3.71, -1.04e-3), viewup=(0, 1.00, 0), distance=22.7, clippingRange=(21.3, 24.6)) # press C to get this lines of code plot(u, text=__doc__, camera=cam, lw=0.1, cmap='Greens_r', size=(600, 300))
""" Scale a mesh asymmetrically in one coordinate """ from dolfin import * from mshr import * domain = Rectangle(Point(0.0, 0.0), Point(5.0, 0.01)) mesh = generate_mesh(domain, 20) V = FunctionSpace(mesh, "CG", 2) e = Expression("sin(2*pi*(x[0]*x[0]+x[1]*x[1]))", degree=2) f = interpolate(e, V) #################################################### from vedo.dolfin import plot plt = plot(f, xtitle='y-coord is scaled by factor 100', scaleMeshFactors=(0.01, 1, 1), style=1, lw=0, warpZfactor=0.001, scalarbar='horizontal', axes={'xTitleOffset':0.2}, text=__doc__, )
[bc.apply(b1) for bc in bcu] solve(A1, u_.vector(), b1) # Step 2: Pressure correction step b2 = assemble(L2) [bc.apply(b2) for bc in bcp] solve(A2, p_.vector(), b2) # Step 3: Velocity correction step b3 = assemble(L3) solve(A3, u_.vector(), b3) # Update previous solution u_n.assign(u_) p_n.assign(p_) # Plot solution plot(u_, cmap='tab10', lw=0, isolines={"n": 12, "lw":1, "c":'black', "alpha":0.1}, warpZfactor=0.8, text=__doc__, axes=7, #bottom ruler ztitle='', interactive=False) print('done.') plot()
print('Test ascalarbar, dolfin version', __version__) if hasattr(MPI, 'comm_world'): mesh = UnitSquareMesh(MPI.comm_world, nx=16, ny=16) else: mesh = UnitSquareMesh(16, 16) V = FunctionSpace(mesh, 'Lagrange', 1) f = Expression('10*(x[0]+x[1]-1)', degree=1) u = interpolate(f, V) actors = plot(u, mode='color', cmap='viridis', vmin=-3, vmax=3, style=1, returnActorsNoShow=True) actor = actors[0] solution = actor.pointdata[0] print('ArrayNames', actor.pointdata.keys()) print('min', 'mean', 'max:') print(np.min(solution), np.mean(solution), np.max(solution), len(solution)) assert len(solution) == 289 assert np.isclose(np.min(solution), -10., atol=1e-05) assert np.isclose(np.max(solution), 10., atol=1e-05)
v = TestFunction(V) a = dot(grad(w), grad(v)) * dx L = p * v * dx # Compute solution w = Function(V) solve(a == L, w, bc) p = interpolate(p, V) # Curve plot along x = 0 comparing p and w import numpy as np tol = 0.001 # avoid hitting points outside the domain y = np.linspace(-1 + tol, 1 - tol, 101) points = [(0, y_) for y_ in y] # 2D points w_line = np.array([w(point) for point in points]) p_line = np.array([p(point) for point in points]) ####################################################################### from vedo.dolfin import plot from vedo import Line, Latex pde = r'-T \nabla^{2} D=p, ~\Omega=\left\{(x, y) | x^{2}+y^{2} \leq R\right\}' tex = Latex(pde, pos=(0, 1.1, .1), s=0.2, c='w') wline = Line(y, w_line * 10, c='white', lw=4) pline = Line(y, p_line / 4, c='lightgreen', lw=4) plot(w, wline, tex, at=0, N=2, bg='bb', text='Deflection') plot(p, pline, at=1, bg='bb', text='Load')
# Apply to RHS of linear system: for ptSrc in ptSrcs: ptSrc.apply(B) # Apply BCs: for bc in [bc1, bc2]: bc.apply(A) bc.apply(B) # Solve: u = Function(V) solve(A, u.vector(), B) # Plot results: acts = plot(u, mode="displacement", returnActorsNoShow=True) actor = acts[0] solution = actor.pointdata[0] print('ArrayNames', actor.pointdata.keys()) print('min', 'mean', 'max:') print(np.min(solution), np.mean(solution), np.max(solution), len(solution)) print('bounds[3]:') print(actor.bounds()[3]) assert np.isclose(np.min(solution), 0.0007107061021966307, atol=1e-03) assert np.isclose(np.mean(solution), 0.012744666491495634, atol=1e-03) assert np.isclose(np.max(solution), 0.4923130138837739, atol=1e-03) assert len(solution) == 1331
- dt*inner(Constant(1.0),p) L = (L0 + L1) * dx # Compute directional derivative about u in the direction of du a = derivative(L, w, du) problem = TuringPattern(a, L) solver = NewtonSolver() solver.parameters["linear_solver"] = "lu" solver.parameters["convergence_criterion"] = "incremental" solver.parameters["relative_tolerance"] = 1e-2 ########################################### time steps from vedo.dolfin import plot, printc t = 0 printc('~bomb Press F1 to abort.', c='y', invert=True) while t < T: t += dt w0.vector()[:] = w.vector() solver.solve(problem, w.vector()) plot(w.split()[0], style=4, lw=0, scalarbar='h', text='time: ' + str(t), interactive=0) plot()
def awefem(mesh, t, source_loc=None): # Function space V = FunctionSpace(mesh, "Lagrange", 1) # Boundary condition bc = DirichletBC(V, Constant(0), "on_boundary") # Trial and test functions u = TrialFunction(V) v = TestFunction(V) # Discretization c = 6 dt = t[1] - t[0] u0 = Function(V) # u0 = uN-1 u1 = Function(V) # u1 = uN1 # Variational formulation F = (u - 2 * u1 + u0) * v * dx + (dt * c) ** 2 * dot( grad(u + 2 * u1 + u0) / 4, grad(v) ) * dx a, L = lhs(F), rhs(F) # Solver A, b = assemble_system(a, L) solver = LUSolver(A, "mumps") solver.parameters["symmetric"] = True bc.apply(A, b) # Solution u = Function(V) # uN+1 # Source if source_loc is None: mesh_center = np.mean(mesh.coordinates(), axis=0) source_loc = Point(mesh_center) else: source_loc = Point(source_loc) # Time stepping printc('\bomb Hit F1 to interrupt.', c='yellow') pb = ProgressBar(0, len(t)) for i, t_ in enumerate(t[1:]): pb.print() b = assemble(L) delta = PointSource(V, source_loc, ricker_source(t_) * dt**2) delta.apply(b) solver.solve(u.vector(), b) u0.assign(u1) u1.assign(u) if t_>0.03: plot(u, warpZfactor=20, # set elevation along z vmin=.0, # sets a minimum to the color scale vmax=0.003, cmap='rainbow', # the color map style alpha=1, # transparency of the mesh lw=0.1, # linewidth of mesh scalarbar=None, #lighting='plastic', #elevation=-.3, interactive=0) # continue execution interactive()
# outward-pointing-normal-vector magnitude at surface : def n_mag_s(x, y): return sp.sqrt(1 + dsdx(x, y)**2 + dsdy(x, y)**2) # surface area of surface : def area(x, y): return sp.integrate(n_mag_s(x, y), (x, 0, 1), (y, 0, 1)) A_exact = area(x, y) for n in [5, 10, 100, 500]: mesh = UnitSquareMesh(n, n) Q = FunctionSpace(mesh, "CG", 1) e = Expression('exp(x[0])', degree=2) f = interpolate(e, Q) A_num = assemble(sqrt(f.dx(0)**2 + f.dx(1)**2 + 1) * dx) print('for n = %i -- error = %.2e' % (n, abs(A_exact.evalf() - A_num))) n = 10 mesh = UnitSquareMesh(n, n) Q = FunctionSpace(mesh, "CG", 1) e = Expression('exp(x[0])', degree=2) f = interpolate(e, Q) A_vector = project(sqrt(f.dx(0)**2 + f.dx(1)**2 + 1), Q) from vedo.dolfin import plot plot(A_vector)
# Define essential boundary def boundary(x): return x[1] < DOLFIN_EPS or x[1] > 1.0 - DOLFIN_EPS bc = DirichletBC(W.sub(0), G, boundary) # Compute solution w = Function(W) solve(a == L, w, bc) (sigma, u) = w.split() ########################################################### vedo from vedo.dolfin import plot, Text3D # Plot solution on mesh, and warp z-axis by the scalar value plot(u, warpZfactor=0.8, legend='u', text=__doc__) # Plot the sigma vector on the mesh. Try also mode='arrows' msg = Text3D("> plot(sigma, mode='mesh lines', warpZfactor= -0.2)", c='w') plot( sigma, msg, mode='mesh lines', warpZfactor=-0.2, # rise mesh in z based on scalar value scale=0.03, # scale the lines or arrows new=True, # new window )
# Assemble: A = assemble(a) B = assemble(L) # Apply point sources: ptSrcLocation = Point(1 - DOLFIN_EPS, 1 - DOLFIN_EPS) # Vectorial point load: f = [0.01, 0.02] # Distinct point sources for x- and y-components ptSrc_x = PointSource(V.sub(0), ptSrcLocation, f[0]) ptSrc_y = PointSource(V.sub(1), ptSrcLocation, f[1]) ptSrcs = [ptSrc_x, ptSrc_y] # Apply to RHS of linear system: for ptSrc in ptSrcs: ptSrc.apply(B) # Apply BCs: for bc in [bc1, bc2]: bc.apply(A) bc.apply(B) # Solve: u = Function(V) solve(A, u.vector(), B) plot(u, mode='displacement')
# Define basis and bilinear form u = TrialFunction(V) v = TestFunction(V) a = dot(grad(u), grad(v)) * dx # Assemble stiffness form A = PETScMatrix() assemble(a, tensor=A) # Create eigensolver eigensolver = SLEPcEigenSolver(A) # Compute all eigenvalues of A x = \lambda x print("Computing eigenvalues. This can take a minute.") eigensolver.solve() # Extract largest (first) eigenpair r, c, rx, cx = eigensolver.get_eigenpair(0) print("Largest eigenvalue: ", r) # Initialize function and assign eigenvector u = Function(V) u.vector()[:] = rx # plot eigenfunction on mesh as colored points (ps=point size) plot(u, mode='mesh', ps=12, cmap='gist_earth') #or as wireframe plot(u, mode='mesh', wireframe=True, cmap='magma')
w = Function(W) solve(a == L, w, bcs) # Split the mixed solution using a shallow copy (u, p) = w.split() ##################################################################### vedo f = r'-\nabla \cdot(\nabla u+p I)=f ~\mathrm{in}~\Omega' formula = Latex(f, pos=(0.55, 0.45, -.05), s=0.1) plot(u, formula, at=0, N=2, mode='mesh and arrows', scale=.03, wireframe=True, scalarbar=False, style=1) plot(p, at=1, text="pressure", cmap='rainbow', interactive=False) ##################################################################### streamlines # A list of seed points (can be automatic: just comment out 'probes') ally = np.linspace(0, 1, num=100) probes = np.c_[np.ones_like(ally), ally, np.zeros_like(ally)] plot( u, mode='mesh with streamlines', streamlines={
# Associate operator (A) and preconditioner matrix (P) solver.set_operators(A, P) # Solve U = Function(W) solver.solve(U.vector(), bb) # Get sub-functions u, p = U.split() pressures = p.compute_vertex_values(mesh) #################################################### vedo from vedo.dolfin import plot, printHistogram # Plot u and p solutions on N=2 synced renderers plot(u, mode='mesh arrows', at=0, N=2, legend='velocity', scale=0.1, wireframe=1, lw=0.03, alpha=0.5, scalarbar=False) printHistogram(pressures, title='pressure histo', logscale=True, c=1) plot(p, mode='mesh', at=1, N=2, legend='pressure', interactive=True)
w = TrialFunction(V) v = TestFunction(V) u = Function(V) f = Constant(-6.0) # Compute solution solve( dot(grad(w), grad(v))*dx == f*v*dx, u, bc) f = r'-\nabla^{2} u=f' ########################################################### vedo from vedo.dolfin import plot, Latex, clear, histogram l = Latex(f, s=0.2, c='w').addPos(.6,.6,.1) plot(u, l, cmap='jet', scalarbar='h', text=__doc__) # Now show uD values on the boundary of a much finer mesh clear() bmesh = BoundaryMesh(UnitSquareMesh(80, 80), "exterior") plot(uD, bmesh, cmap='cool', ps=5, legend='boundary') # ps = point size # now make some nonsense plot with the same plot() function yvals = u.compute_vertex_values(mesh) xvals = np.arange(len(yvals)) plt = plot(xvals, yvals, 'go-') plt.show(new=True) # and a histogram hst = histogram(yvals)