Terminate GMT modern mode session and produce optional graphics


gmt end [ show ] [ -V[level] ]

Note: No space is allowed between the option flag and the associated arguments.


This end module terminates the modern mode session created with begin and finalizes the processing of all registered figures. The final graphics will be placed in the current directory and the hidden sessions directory will be removed.

Optional Arguments


Open all graphics produced by the session in the default viewer. Note: In the event you have selected more than one output format we only open the first one listed.


Select verbosity level [w]. (See full description) (See cookbook information).

-^ or just -

Print a short message about the syntax of the command, then exits (Note: on Windows just use -).

-+ or just +

Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exits.

-? or no arguments

Print a complete usage (help) message, including the explanation of all options, then exits.


We first create a modern mode session using begin, do plotting, and close the current modern session and finalize any plots requested:

gmt begin
  gmt basemap -R0/10/0/10 -JX10c -Baf
gmt end

Here is the same example, but this time we want to name the map, create both PDF and PNG versions of it, and automatically open the PDF file in the relevant viewer:

gmt begin map pdf,png
  gmt basemap -R0/10/0/10 -JX10c -Baf
gmt end show

Disable display

If you wish to run scripts that end with gmt end show but sometimes prefer to not display the results without having to edit all the scripts, you can set the environmental parameter GMT_END_SHOW to off.

See Also

begin, clear, docs, figure, inset, subplot, gmt