Minitab Help contains topics documenting the various codes. You can find these topics with a simple search.
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.
For TIFF (Tagged Image File Format), use the subcommand TIFC. For PNG (Portable Network Graphics), use PNGC. 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.
Use the GPRINT command.
This example creates a histogram and boxplot, and prints the boxplot.
HIST C1; BOXPLOT C1; GPRINT.
This example creates a histogram and boxplot, saves the graphs as HIST.MGF and BOX.MGF respectively, and prints the boxplot.
HIST C1; GSAVE "HIST.MGF". BOXPLOT C1; GSAVE "BOX.MGF". GPRINT
This example creates a histogram and boxplot, saves the graphs as HIST.MGF and BOX.MGF respectively, and prints the histogram.
HIST C1; GSAVE "HIST.MGF". BOXPLOT C1; GSAVE "BOX.MGF". GPRINT "HIST.MGF"
With no argument, as in Example 1 and 2, GPRINT prints the active Graph window. With an argument, GPRINT will open the specified graph and send it to the computer's default 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.
To control pausing, include one of the following forms of the GPAUSE command in your macro:
This command tells Minitab to pause for K seconds (K can be any integer between 0 to 1800) after displaying each graph until you press any key or the mouse button.
An undocumented Session command, GMANAGER, can be used to close graphs.
This command is experimental and has not been as rigorously tested as commands documented in Help. Although the command is usable, you should apply it with caution--we do not take responsibility for any unexpected results. The form and syntax of this command are subject to change.
To close the last graph, use the following command:
To close all graphs, use the following command:
GMANAGER; ALL; CLOSE; NOPROMPT.
If you do not want to be prompted to save the graph before closing do the following:
Note that changes you make inwill apply when closing all future graphs.
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.