8.1 Formatting MATLAB graphics and output figures#
SDT implements single comgui ImWrite and multiple iicom ImWrite image generation mechanisms. The basic process is to
- generate your figure,
- call comgui objSet for the initial formatting,
- use sdtroot Set to define project information such as the plot output directory.
- use comgui PlotWd to predefine output options (directory, file name generation scheme, reformatting for image generation, insertion options for word, ...)
8.1.1 Formatting operations with objSet#
cingui('objSet',h,Prop) groups all formatting operations needed to obtain exactly the figure you want (font size, axes positions, line sequencing, ...) starting from a pointer to a MATLAB graphic h and a style given as cell array of formatting instructions Prop. It is the base SDT mechanism to generalize the MATLAB set command.
Prop is a cell array of tag-value pairs classical in MATLAB handle properties comgui objSet allows three types of modification
- recursion into objects or object search. Thus the property '@axes' of a figure is a handle to all axes within this figure or '@line(2)' is the second line object.
- expansion is the mechanism where a tag-value pairs is actually replaced by a larger list of tag-value pairs. The definition of styles using comgui objSet entries leads to the use of expansion in the form '@OsDic(SDT Root)',{'val1','val2'}. This mechanism is key to let the user manage predefined styles.
- Value replacement/verification to enhance basic set commands used by MATLAB. Thus with 'Position',[NaN NaN 500 300] the lower left corner values shown here as NaN are replaced by their current value.
8.1.2 Persistent data in Project#
The Project tab is initialized using sdtroot Set commands. The most commonly used fields are the project and plot directories and file name for export to Word, PowerPoint. Their use is illustrated in the next section.
sdtroot('SetProject',struct('ProjectWd',sdtdef('tempdir'), ... 'root','MyTest'));
8.1.3 OsDic dictionary of names styles#
The comgui objSet provides a basic mechanism to provide formatting instructions. As choosing those takes time and for the sake of uniformity it is useful to introduce style sheets, which SDT does using a list of named styles, as shown in figure 8.3.
Basic implementations of most styles are provided in d_imw (see list with sdtweb('_taglist','d_imw')). The main categories of styles are
-
Im : image formatting
- SmallWide for a wide picture (9:16) (landscape style) adapted to reports.
- SmallSquare for a square picture (4:3) adapted to reports.
- SmallHigh for a vertical rectangular picture (9:16) adapted to reports.
- LargeWide for a wide picture (landscape style) adapted to posters.
- LargeSquare for a square picture (4:3) adapted to posters.
- WideBar for a (4:3) landscape style picture. It has the same width than SmallWide but is higher, this is mostly convenient for wide bar diagrams.
- Cb colorbar insertion
- Cm colormap definition
- Cr image cropping options
- Fn file naming strategy. Fn + a combination of Root (project root field), T(itle) (figure title), xlabel, ylabel, zlabel (figure label), ii_legend (see ii_plp Legend), Name (cf.data.name), Model (cf.mdl.name), Colorbar
- Pr figure configurations when opening project. See sdtweb('d_imw','Pr')
- Fi feplot view initialization using a comgui objSet call.
- Ii iiplot view initialization using a comgui objSet call.
- ...
8.1.4 File name generation with objString#
The ability to generate context based file names is obtained using comgui objString. The principle is to provide a cell array of strings where '@command' string are interpreted.