gf_plot_slice — this function is used to plot a slice of mesh/mesh_fem
function [hfaces, htube, hquiver, hmesh]=gf_plot_slice(sl,varargin)
This function is used to plot a slice of mesh/mesh_fem (see gf_slice).
The options are specified as pairs of 'option name'/'option value':
data [] data to be plotted (one value per slice node)
convex_data [] data to be plotted (one value per mesh convex)
mesh 'auto' :
'on' -> show the mesh (faces of edges)
'off' -> ignore mesh
mesh_edges 'on' show mesh edges ?
mesh_edges_color [0.60 0.60 1] color of mesh edges
mesh_edges_width 0.70 width of mesh edges
mesh_slice_edges 'on' show edges of the slice ?
mesh_slice_edges_color [0.70 0 0]
mesh_slice_edges_width 0.50
mesh_faces 'off' 'on' -> fill mesh faces (otherwise they are transparent)
mesh_faces_color [0.75 0.75 0.75]
pcolor 'on' if the field is scalar, a color plot of its values is plotted
quiver 'on' if the field is vector, represent arrows
quiver_density 50 density of arrows in quiver plot
quiver_scale 1 density of arrows in quiver plot
tube 'on' use tube plot for 'filar' (1D) parts of the slice
tube_color 'red' color of tubes (ignored if 'data' is not empty and 'pcolor' is on)
tube_radius '0.05 tube radius; you can use a constant, or a vector of nodal values
showoptions 'on' display the list of options
The 'data' and 'convex_data' are mutually exclusive.
Consider that you have a 3D mesh fem mf and a vector field U defined on this mesh fem, solution of the Stokes problem in a tank (see the demo demo_stokes_3D_tank_draw.m in the tests directory).
scf(); // use a nice colormap c = [0 0 1; 0 .5 1; 0 1 .5; 0 1 0; .5 1 0; 1 .5 0; 1 .4 0; 1 0 0; 1 .2 0; 1 .4 0; 1 .6 0; 1 .8 0]; h = gcf(); h.color_map = colormap(c); // slice the mesh with two half spaces, and take the boundary of the resulting quarter-cylinder sl = gf_slice(list('boundary',list('intersection',list('planar',+1,[0;0;0],[0;1;0]},... list('planar',+1,[0;0;0],[1;0;0]))),m,6); Usl = gf_compute(pde('mf_u'),U,'interpolate on', sl); // interpolate the solution on the slice // show the norm of the displacement on this slice gf_plot_slice(sl,'mesh','on','data',sqrt(sum(Usl.^2,1)),'mesh_slice_edges','off'); // another slice: now we take the lower part of the mesh sl = gf_slice(list('boundary',list('intersection',list('planar',+1,[0;0;6],[0;0;-1]},... list('planar',+1,[0;0;0],[0;1;0]))),m,6); Usl = gf_compute(pde('mf_u'),U,'interpolate on', sl); gf_plot_slice(sl,'mesh','on','data',sqrt(sum(Usl.^2,1)),'mesh_slice_edges','off'); // this slice contains the transparent mesh faces displayed on the picture sl2 = gf_slice(list('boundary',list('planar',+1,[0;0;0],[0;1;0])),... m,6,_setdiff(all_faces',TOPfaces','rows')'); gf_plot_slice(sl2,'mesh_faces','off','mesh','on','pcolor','off'); // last step is to plot the streamlines hh = [1 5 9 12.5 16 19.5]; // vertical position of the different starting points of the streamlines H = [zeros(2,length(hh));hh]; // compute the streamlines tsl = gf_slice('streamlines',pde('mf_u'),U,H); Utsl = gf_compute(pde('mf_u'),U,'interpolate on', tsl); // render them with "tube plot" [a,h] = gf_plot_slice(tsl,'mesh','off','tube_radius',.2,'tube_color','white');