.. index:: ! psclip

******
psclip
******

.. only:: not man

    psclip - Initialize or terminate polygonal clip paths

Synopsis
--------

.. include:: common_SYN_OPTs.rst_

**psclip** [ *table* ] **-J**\ *parameters*
|SYN_OPT-Rz|
[ **-A**\ [**m**\ \|\ **p**] ]
[ |SYN_OPT-B| ]
**-Jz**\ \|\ **Z**\ *parameters* ] [ **-K** ] [ **-N** ] [ **-O** ]
[ **-P** ] [ **-T** ]
[ |SYN_OPT-U| ]
[ |SYN_OPT-V| ]
[ |SYN_OPT-X| ]
[ |SYN_OPT-Y| ]
[ |SYN_OPT-bi| ]
[ |SYN_OPT-c| ]
[ |SYN_OPT-f| ]
[ |SYN_OPT-g| ]
[ |SYN_OPT-h| ]
[ |SYN_OPT-i| ]
[ |SYN_OPT-p| ]
[ |SYN_OPT-t| ]
[ |SYN_OPT-:| ]

**psclip** **-C**\ [\ *n*] [ **-K** ] [ **-O** ]

|No-spaces|

Description
-----------

**psclip** 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,
**psclip** uses 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
**psclip** a second time with the **-C** option only. 

Required Arguments
------------------

**-C**\ [\|\ *n*]
    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.
    
.. include:: explain_-J.rst_

.. |Add_-R| unicode:: 0x20 .. just an invisible code
.. include:: explain_-R.rst_

.. |Add_-Rz| unicode:: 0x20 .. just an invisible code
.. include:: explain_-Rz.rst_

Optional Arguments
------------------

.. |Add_intables| unicode:: 0x20 .. just an invisible code
.. include:: explain_intables.rst_

**-A**\ [**m**\ \|\ **p**]
    By default 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). 

.. include:: explain_-B.rst_

.. include:: explain_-Jz.rst_

.. include:: explain_-K.rst_

**-N**
    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**. 

.. include:: explain_-O.rst_

.. include:: explain_-P.rst_

**-T**
    Rather than read any input files, simply turn on clipping for the
    current map region. Basically, **-T** is a convenient way to run
    **psclip** with the arguments **-N** /dev/null (or, under Windows,
    **-N** NUL). Cannot be used together with **-B**. 

.. include:: explain_-U.rst_

.. |Add_-V| unicode:: 0x20 .. just an invisible code
.. include:: explain_-V.rst_

.. include:: explain_-XY.rst_

.. |Add_-bi| replace:: [Default is 2 input columns]. 
.. include:: explain_-bi.rst_

.. include:: explain_-c.rst_

.. |Add_-f| unicode:: 0x20 .. just an invisible code
.. include:: explain_-f.rst_

.. |Add_-g| unicode:: 0x20 .. just an invisible code
.. include:: explain_-g.rst_

.. |Add_-h| unicode:: 0x20 .. just an invisible code
.. include:: explain_-h.rst_

.. include:: explain_-icols.rst_

.. |Add_perspective| unicode:: 0x20 .. just an invisible code
.. include:: explain_perspective.rst_

.. include:: explain_-t.rst_

.. include:: explain_colon.rst_

.. include:: explain_help.rst_

Examples
--------

To make an overlay PostScript file that will set up a complex clip
area to which subsequent plotting will be confined, run:

   ::

    gmt psclip my_region.xy -R0/40/0/40 -Jm0.3i -O -K > clip_mask_on.ps

To deactivate the clipping in an existing plotfile, run:

   ::

    gmt psclip -C -O >> complex_plot.ps

See Also
--------

:doc:`gmt`, :doc:`grdmask`,
:doc:`psbasemap`, :doc:`psmask`
