Manually plotting grid using plotgrid

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Manually plotting grid using plotgrid

randress
In another thread (Basic Use --> Viewing Mesh/Grid Internal to Subdomains) an example was given for the use of plotgrid.m after exporting the 'grid' struc to Matlab.
   plotgrid( grid, 'selcells', selcells(grid,'y>0.5') )
The above will plot the all grid cells where the cell 'y' coordinate is greater than 0.5.

Could you provide reference, guidance, and/or examples for using other VARARGIN parameter/value pairs may be used to, for example, plot only the grid from sub-domain 2, or how to set the grid face style and color, or transparency, etc.?  References to other function implementations (.m) might be helpful.

11.316 plotgrid
PLOTGRID Grid plot function.
[ H ] = PLOTGRID( PROB, VARARGIN ) Function to plot and visualize a grid. PROB is a valid grid or
problem struct. Accepts the following property/value pairs.

Property Value/{Default} Description
----------------------------------------------------------
axis off|{on} Show axes
grid on |{off} Show grid
axequal off|{on} Axis equal setting
edges on |{off} Show internal edges (3D only)
view {[45 45]} 3D view setting
bbox {0.05} Size of bounding box (0=off)
alpha {1} Transparency level
facecolor {[.9 .9 .9]} Cell face style or fixed color
linestyle {-} Line style
linewidth {1} Line width
edgecolor {b} Line color
edgecolor {[.7 .7 .7]} Cell line color
marker {.} Node marker style
markercolor {b} Node marker color
cellabels on|{off} Show cell numbers
nodelabels on|{off} Show vertex/node numbers
fontsize {axes default} Font size used in text
selcells {all} Index vector to cells to plot
selsubd {all} Index vector to subdomains to plot
renderer {empty string}|plotly Render in Matlab/Octave or Plotly
parent {gca} Plot axes handle
setaxes {on}|off Use axes modification settings
Reply | Threaded
Open this post in threaded view
|

Re: Manually plotting grid using plotgrid

Precise Simulation
Administrator
randress wrote
In another thread (Basic Use --> Viewing Mesh/Grid Internal to Subdomains) an example was given for the use of plotgrid.m after exporting the 'grid' struc to Matlab.
   plotgrid( grid, 'selcells', selcells(grid,'y>0.5') )
The above will plot the all grid cells where the cell 'y' coordinate is greater than 0.5.

Could you provide reference, guidance, and/or examples for using other VARARGIN parameter/value pairs may be used to, for example, plot only the grid from sub-domain 2, or how to set the grid face style and color, or transparency, etc.?  References to other function implementations (.m) might be helpful.

11.316 plotgrid
PLOTGRID Grid plot function.
[ H ] = PLOTGRID( PROB, VARARGIN ) Function to plot and visualize a grid. PROB is a valid grid or
problem struct. Accepts the following property/value pairs.

Property Value/{Default} Description
----------------------------------------------------------
axis off|{on} Show axes
grid on |{off} Show grid
axequal off|{on} Axis equal setting
edges on |{off} Show internal edges (3D only)
view {[45 45]} 3D view setting
bbox {0.05} Size of bounding box (0=off)
alpha {1} Transparency level
facecolor {[.9 .9 .9]} Cell face style or fixed color
linestyle {-} Line style
linewidth {1} Line width
edgecolor {b} Line color
edgecolor {[.7 .7 .7]} Cell line color
marker {.} Node marker style
markercolor {b} Node marker color
cellabels on|{off} Show cell numbers
nodelabels on|{off} Show vertex/node numbers
fontsize {axes default} Font size used in text
selcells {all} Index vector to cells to plot
selsubd {all} Index vector to subdomains to plot
renderer {empty string}|plotly Render in Matlab/Octave or Plotly
parent {gca} Plot axes handle
setaxes {on}|off Use axes modification settings
The plotgrid options are listed in your quote (with defaults), the propery value pair:

     plotgrid( fea, 'selsubd', 2 )

selects cells in subdomain 2 to plot.

     plotgrid( fea, 'selsubd', 2, 'facecolor', [1 0 0] )

also specifies rgb face color red.

     plotgrid( fea, 'selsubd', 2, 'facecolor', [1 0 0], 'alpha', 0.5 )

also sets the transparency to 0.5. To find out what some of the options do you can also have a look at the Matlab documentation for plotting commands (plot, line, patch etc) which are used to build up the plots. For example

     help plot
     help patch
     help alpha

For command line usage you can also save/export a model from the GUI as an Matlab m-file script (using the  File > Save As MATLAB Script... menu option) and see how the equivalent commands will look like that build up your model (you can also look at the available FEATool m-file examples).