inset¶
Manage figure inset setup and completion
The inset module is used to carve out a sub-region of the current plot canvas and restrict further plotting to that section of the canvas. The inset setup is started with the begin directive that defines the placement and size of the inset. Subsequent plot commands will be directed to that window. The inset is completed via the end directive, which reverts operations to the full canvas and restores the plot region and map projection that was in effect prior to the setup of the inset.
Synopsis (begin mode)¶
gmt inset begin -Dinset-box [ -Fbox ] [ -Mmargins ] [ -N ] [ -V[level] ] [ --PAR=value ]
Note: No space is allowed between the option flag and the associated arguments.
Description¶
The begin directive of inset defines the dimension and placement of the inset canvas. It records the current region and projection so that we may return to the initial plot environment when the inset is completed. The user may select any plot region and projection once plotting in the inset, but if the first command uses a projection that leaves off the scale or width then we supply a scale or width to fill the inset as best as possible, given the inset size and margins (if selected).
Required Arguments (begin mode)¶
- -Dxmin/xmax/ymin/ymax[+r][+uunit]] | -D[g|j|J|n|x]refpoint+wwidth[/height][+jjustify][+odx[/dy]]
Define the map inset rectangle on the map. Specify the rectangle in one of three ways:
Append glon/lat for map coordinates. Requires both -R and -J to be set.
Append jcode or Jcode for setting the refpoint via a 2-char justification code that refers to the (invisible) projected map bounding box. Requires both -R and -J to be set.
Append nxn/yn for normalized bounding box coordinates (0-1). Requires both -R and -J to be set.
Append xx/y for plot coordinates (append cm, inch, or ppoint).
Alternatively, Give west/east/south/north of geographic rectangle bounded by parallels and meridians; append +r if the coordinates instead are the lower left and upper right corners of the desired rectangle. (Or, give xmin/xmax/ymin/ymax of bounding rectangle in projected coordinates and optionally append +uunit [Default coordinate unit is meter (e)]. Append +wwidth[/height] of bounding rectangle or box in plot coordinates (inches, cm, etc.). By default, the anchor point on the scale is assumed to be the bottom left corner (BL), but this can be changed by appending +j followed by a 2-char justification code justify (see text). Note: If -Dj is used then justify defaults to the same as refpoint, if -DJ is used then justify defaults to the mirror opposite of refpoint. Specify inset box attributes via the -F option [outline only].
Optional Arguments (begin mode)¶
-F[+cclearances][+gfill][+i[[gap/]pen]][+p[pen]][+r[radius]][+s[[dx/dy/][shade]]]
Without further options, draws a rectangular border around the map inset using MAP_FRAME_PEN. The following modifiers can be appended to -F, with additional explanation and examples provided in the The background panel cookbook section:
+cclearance where clearance is either gap, xgap/ygap, or lgap/rgap/bgap/tgap and gap gives a uniform clearance, xgap/ygap gives separate clearances in the x- and y- directions, and lgap/rgap/bgap/tgap gives individual clearances between the map embellishment and the border for each side.
+gfill to fill the box with a color specified by fill [default is no fill].
+i[[gap/]pen] to draw a secondary, inner border as well. Optionally, specify the gap between the inner and outer border and the pen for the inner border [default is a uniform gap between borders of 2p and the MAP_DEFAULT_PEN].
+ppen to specify different pen attributes.
+r[radius] to draw rounded rectangular borders instead with a corner radius set by radius (append units) [defaults is 6p].
+s[[dx/dy/][shade]] to draw an offset background shaded region. Here, dx/dy indicates the shift relative to the foreground frame [default is 4p/-4p] and shade sets the fill style to use for shading [default is gray50].
- -Mmargins
This is clearance that is added around the inside of the inset. Plotting will take place within the inner region only. The margins can be a single value, a pair of values separated by slashes (for setting separate horizontal and vertical margins), or the full set of four margins (for setting separate left, right, bottom, and top margins) [no margins].
- -N
Do NOT clip features extruding outside map inset boundaries [Default will clip].
- -V[level]
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.
Synopsis (end mode)¶
gmt inset end [ -V[level] ]
The end directive finalizes the current inset, which returns the plotting environment to the state prior to the start of the inset. The previous region and map projection will be in effect going forward.
Optional Arguments (end mode)¶
- -V[level]
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.
Examples¶
To make a simple basemap plot called inset.pdf that demonstrates the inset module, try
gmt begin inset pdf gmt basemap -R0/40/20/60 -JM6.5i -Bafg -B+glightgreen gmt inset begin -DjTR+w2.5i+o0.2i -F+gpink+p0.5p -M0.25i gmt basemap -Rg -JA20/20/ -Bafg gmt text -F+f18p+cTR+tINSET -Dj-0.15i -N gmt inset end gmt text -F+f18p+cBL+tMAP -Dj0.2i gmt end