gf_plot

Purpose

General plotting function for 2D and 3D fields. 

Synopsis

[hsurf, hcontour, hquiver, hmesh, hdefmesh]=gf_plot(mf,U[, options...])

Description

This function only works (for the moment) with 2D faces. The function expects U to be a row vector. If U is a scalar field, then gf_plot(mf,U) will fill the mesh with colors representing the values of U. If U is a vector field, then the default behavior of gf_plot is to draw vectors representing the values of U. The various pairs of "option name"/"option value" that can be used are:

'zplot',{'off' | 'on'} values of U are mapped on the z-axis (only possible when qdim=1, mdim=2)
'norm', {'off' | 'on'} if qdim >= 2, color-plot the norm of the field.
'dir',[] if qdim >= 2, color-plot the scalar product of the field with dir (dir can be a vector, or 'x', 'y', etc..)
'refine',8 number of refinements for curved edges and surface plots.
'interpolated',{'off' | 'on'} if the color of triangular patches is interpolated between vertices, or flat.
'pcolor',{'on' | 'off'} if the field is scalar, a color plot of its values is plotted.
'quiver',{'on' | 'off'} if the field is vector, enable arrows plot.
'quiver_density',50 specify the density of arrows in quiver plots.
'quiver_scale',1.0 specify the scaling of arrows (0 => scaling disabled).
'mesh',{'off' | 'on'} show the mesh ?
'meshopts',{cell(0)} cell array of options passed to gf_plot_slice for the mesh visualization (you may prefer to use hold on and call explicitly gf_plot_slice or gf_plot_mesh).
'deformed_mesh', {'off'|'on'} shows the deformed mesh (only possible when qdim == mdim).
'deformed_meshopts', {cell(0)} cell array of options passed to gf_plot_slice for the deformed mesh.
'deformation',[] if non-empty, enables the plot on the deformed object. The option argument is used as the deformation field.
'deformation_mf',[] specify the mesh_fem on which the deformation field is defined.
'deformation_scale','10%' indicate the amplitude of the deformation. Can be a percentage of the mesh width if given as a string, or an absolute value if given as a number.
'cvlst',[] list of convexes to plot (empty => all convexes).
'title',[] set the title.
'contour',[] list of contour values.

For example, plotting a scalar field on the border of a 3D mesh can be done with
% load the 'strange.mesh_fem' (found in the getfem_matlab/tests directory)
mf=gf_mesh_fem('load', 'strange.mesh_fem') 
U=rand(1, gf_mesh_fem_get(mf, 'nbdof')); # random field that will be drawn
gf_plot(mf, U, 'refine', 25, 'cvlst', gf_mesh_get(mf,'outer faces'), 'mesh','on');  

See Also