Initialize or terminate polygonal clip paths


gmt psclip [ table ] -Jparameters -C[n] -Rwest/east/south/north[/zmin/zmax][+r][+uunit] [ -A[m|p|x|y] ] [ -B[p|s]parameters ] [ -K ] [ -N ] [ -O ] [ -P ] [ -T ] [ -U[stamp] ] [ -V[level] ] [ -W[pen] ] [ -X[a|c|f|r][xshift[u]] ] [ -Y[a|c|f|r][yshift[u]] ] [ -bibinary ] [ -dinodata ] [ -eregexp ] [ -fflags ] [ -ggaps ] [ -hheaders ] [ -iflags ] [ -pflags ] [ -ttransp ] [ -:[i|o] ] [ --PAR=value ]

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


Reads (x,y) file(s) [or standard input] and draws polygons that are activated as clipping paths. Several files may be read to create complex paths consisting of several non-connecting segments. Only marks that are subsequently drawn inside the clipping path will be shown. To determine what is inside or outside the clipping path, we use the even-odd rule. When a ray drawn from any point, regardless of direction, crosses the clipping path segments an odd number of times, the point is inside the clipping path. If the number is even, the point is outside. The -N option, reverses the sense of what is the inside and outside of the paths by plotting a clipping path along the map boundary. After subsequent plotting, which will be clipped against these paths, the clipping may be deactivated by running the module a second time with the -C option only.

Required Arguments

Mark end of existing clip path(s). No input file will be processed. No projection information is needed unless -B has been selected as well. With no arguments we terminate all active clipping paths. Experts may restrict the termination to just n of the active clipping path by passing that as the argument. Remember to supply -X and -Y settings if you have moved since the clip started.
-Jparameters (more …)
Select map projection.
-Rxmin/xmax/ymin/ymax[+r][+uunit] (more …)
Specify the region of interest.

For perspective view -p, optionally append /zmin/zmax. (more …)

Optional Arguments

One or more ASCII (or binary, see -bi[ncols][type]) data table file(s) holding a number of data columns. If no tables are given then we read from standard input.
By default, geographic line segments are connected as great circle arcs. To connect them as straight lines, use the -A flag. Alternatively, add m to connect the line by first following a meridian, then a parallel. Or append p to start following a parallel, then a meridian. (This can be practical to connect lines along parallels, for example). For Cartesian data, points are simply connected, unless you append x or y to construct stair-case paths whose first move is along x or y, respectively.
-B[p|s]parameters (more …)
Set map boundary frame and axes attributes.
Invert the sense of what is inside and outside. For example, when using a single path, this means that only points outside that path will be shown. Cannot be used together with -B.
Rather than read any input files, simply turn on clipping for the current map region. Basically, -T is a convenient way to run the module with the arguments -N /dev/null (or, under Windows, -N NUL). Cannot be used together with -B.
-U[label][+c][+jjust][+odx/dy] (more …)
Draw GMT time stamp logo on plot.
-V[level] (more …)
Select verbosity level [c].
Draw outline of clip path using given pen attributes [Default is no outline].


-Y[a|c|f|r][yshift[u]] (more …)
Shift plot origin.
-bi[ncols][t] (more …)
Select native binary format for primary input. [Default is 2 input columns].
-dinodata (more …)
Replace input columns that equal nodata with NaN.
-e[~]”pattern” | -e[~]/regexp/[i] (more …)
Only accept data records that match the given pattern.
-f[i|o]colinfo (more …)
Specify data types of input and/or output columns.
-g[a]x|y|d|X|Y|D|[col]zgap[u][+n|p] (more …)
Determine data gaps and line breaks.
-h[i|o][n][+c][+d][+rremark][+rtitle] (more …)
Skip or produce header record(s).
-icols[+l][+sscale][+ooffset][,][,t[word]] (more …)
Select input columns and transformations (0 is first column, t is trailing text, append word to read one word only).
-p[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0] (more …)
Select perspective view.
-t[transp] (more …)
Set transparency level in percent.
-:[i|o] (more …)
Swap 1st and 2nd column on input and/or output.
-^ 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.
Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.

Classic Mode Arguments

These options are used to manipulate the building of layered GMT PostScript plots in classic mode. They are not available when using GMT modern mode.

-K (more …)
Do not finalize the PostScript plot.
-O (more …)
Append to existing PostScript plot.
-P (more …)
Select “Portrait” plot orientation.


To see the effect of a simple clip path which result in some symbols being partly visible or missing altogether, try

gmt psclip -R0/6/0/6 -Jx2.5c -W1p,blue -P -K << EOF >
0 0
5 1
5 5
gmt psxy @tut_data.txt -Gred -Sc2c -R -J -O -K >>
gmt psclip -C -O -R -J -Baf >>

where we activate and deactivate the clip path. Note we also draw the outline of the clip path to make it clear what is being clipped.