The following are answers to some of the most common questions users have about graphs in macros. For complete guidance on creating and running macros, see Minitab Macros Help.
Create the graph using the session command, the GSAVE subcommand, and the applicable graphics format subcommand. For example, suppose you want to create a histogram of column C1 and save the graph as a JPEG in the root of your C: drive with the filename Defects. Use the following commands:
HIST C1;
GSAVE "C:\Defects";
JPEG.
The default graph file is saved as a PNG (Portable Network Graphics), which is the PNGC subcommand. For TIFF (Tagged Image File Format), use the subcommand TIFC. For Windows BMP (Windows Bitmap), use BMPC.
In a macro, you may see GSAVE used in other commands, such as CALL. The graphics format subcommand mentioned here, such as JPEG, should not be inserted in such cases.
In Minitab 19 and higher, you cannot use a macro to send any output to a physical printer.
For example, suppose you want to put the current date as a footnote on a histogram of a column called YIELD.
The steps below assume that columns called YIELD and TMPDATE, and a constant called DATE are listed in the declaration section of the local macro, and that the column YIELD contains data.
LET TMPDATE = TODAY()
If you want the current date and time on the graph, use NOW() instead of TODAY().
TEXT TMPDATE TMPDATE
LET DATE = TMPDATE
HIST YIELD;
FOOTNOTE DATE.
Minitab 19 and higher does not provide this capability.
Minitab 19 and higher does not provide this capability. To close individual output tabs, click the x on the tab. To delete an individual graph from inside of an output pane, right click the graph and choose Delete. You can reopen a closed tab, but you can not undelete a graph.
You can use subcommands such as GSAVE and WTITLE for graphs that do not include these subcommands if you also use the LAYOUT command.
LAYOUT;
GSAVE "C:\My Statistics\YIELD.JPG";
JPEG;
WTITLE "San Francisco".
GSUMMARY C1
ENDLAYOUT.
GageRR;
Parts 'Part';
Opers 'Operator';
Response 'Measurement';
Studyvar 6.
LAYOUT;
GSAVE "Q:\Project\GageRR.JPG";
JPEG;
WTITLE "Gage 1".
GageRR;
Parts 'Part';
Opers 'Operator';
Response 'Measurement';
Studyvar 6.
ENDLAYOUT.