Skip to content

Commit af4a43e

Browse files
weiji14seisman
andauthored
Complete documentation for plot (#666)
All major arguments for `plot` are now aliased and documented as per upstream GMT docs at https://docs.generic-mapping-tools.org/6.1/plot.html * Alias straight_line(A), error_bar(E), close(L), offset(D) for plot * Alias connection (F), intensity (I) and zvalue (Z) for plot * Change some args to italics instead of bold, and use singular aliases Co-Authored-By: Dongdong Tian <[email protected]>
1 parent 828ac3e commit af4a43e

File tree

1 file changed

+92
-28
lines changed

1 file changed

+92
-28
lines changed

pygmt/base_plotting.py

Lines changed: 92 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -606,47 +606,52 @@ def grdview(self, grid, **kwargs):
606606

607607
@fmt_docstring
608608
@use_alias(
609-
R="region",
610-
J="projection",
609+
A="straight_line",
611610
B="frame",
612-
S="style",
611+
C="cmap",
612+
D="offset",
613+
E="error_bar",
614+
F="connection",
613615
G="color",
616+
I="intensity",
617+
J="projection",
618+
L="close",
614619
N="no_clip",
615-
W="pen",
616-
i="columns",
617-
l="label",
618-
C="cmap",
620+
R="region",
621+
S="style",
619622
U="timestamp",
620623
V="verbose",
624+
W="pen",
621625
X="xshift",
622626
Y="yshift",
627+
Z="zvalue",
628+
i="columns",
629+
l="label",
623630
p="perspective",
624631
t="transparency",
625632
)
626633
@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence")
627634
def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
628635
"""
629-
Plot lines, polygons, and symbols on maps.
630-
631-
Used to be psxy.
636+
Plot lines, polygons, and symbols in 2-D.
632637
633638
Takes a matrix, (x,y) pairs, or a file name as input and plots lines,
634639
polygons, or symbols at those locations on a map.
635640
636641
Must provide either *data* or *x* and *y*.
637642
638-
If providing data through *x* and *y*, *color* (G) can be a 1d array
639-
that will be mapped to a colormap.
643+
If providing data through *x* and *y*, *color* can be a 1d array that
644+
will be mapped to a colormap.
640645
641-
If a symbol is selected and no symbol size given, then psxy will
646+
If a symbol is selected and no symbol size given, then plot will
642647
interpret the third column of the input data as symbol size. Symbols
643648
whose size is <= 0 are skipped. If no symbols are specified then the
644-
symbol code (see *S* below) must be present as last column in the
645-
input. If *S* is not used, a line connecting the data points will be
646-
drawn instead. To explicitly close polygons, use *L*. Select a fill
647-
with *G*. If *G* is set, *W* will control whether the polygon outline
648-
is drawn or not. If a symbol is selected, *G* and *W* determines the
649-
fill and outline/no outline, respectively.
649+
symbol code (see *style* below) must be present as last column in the
650+
input. If *style* is not used, a line connecting the data points will
651+
be drawn instead. To explicitly close polygons, use *close*. Select a
652+
fill with *color*. If *color* is set, *pen* will control whether the
653+
polygon outline is drawn or not. If a symbol is selected, *color* and
654+
*pen* determines the fill and outline/no outline, respectively.
650655
651656
Full option list at :gmt-docs:`plot.html`
652657
@@ -671,19 +676,69 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
671676
depending on the style options chosen.
672677
{J}
673678
{R}
674-
A : bool or str
675-
``'[m|p|x|y]'``
679+
straight_line : bool or str
680+
``[m|p|x|y]``.
676681
By default, geographic line segments are drawn as great circle
677-
arcs. To draw them as straight lines, use *A*.
682+
arcs. To draw them as straight lines, use *straight_line*.
683+
Alternatively, add **m** to draw the line by first following a
684+
meridian, then a parallel. Or append **p** to start following a
685+
parallel, then a meridian. (This can be practical to draw a line
686+
along parallels, for example). For Cartesian data, points are
687+
simply connected, unless you append **x** or **y** to draw
688+
stair-case curves that whose first move is along *x* or *y*,
689+
respectively.
678690
{B}
679691
{CPT}
680-
D : str
681-
``'dx/dy'``: Offset the plot symbol or line locations by the given
682-
amounts dx/dy.
683-
E : bool or str
684-
``'[x|y|X|Y][+a][+cl|f][+n][+wcap][+ppen]'``.
685-
Draw symmetrical error bars.
692+
offset : str
693+
``dx/dy``.
694+
Offset the plot symbol or line locations by the given amounts
695+
*dx/dy* [Default is no offset]. If *dy* is not given it is set
696+
equal to *dx*.
697+
error_bar : bool or str
698+
``[x|y|X|Y][+a][+cl|f][+n][+wcap][+ppen]``.
699+
Draw symmetrical error bars. Full documentation is at
700+
:gmt-docs:`plot.html#e`.
701+
connection : str
702+
``[c|n|r][a|f|s|r|refpoint]``.
703+
Alter the way points are connected (by specifying a *scheme*) and
704+
data are grouped (by specifying a *method*). Append one of three
705+
line connection schemes:
706+
707+
- **c** : Draw continuous line segments for each group [Default].
708+
- **r** : Draw line segments from a reference point reset for each
709+
group.
710+
- **n** : Draw networks of line segments between all points in
711+
each group.
712+
713+
Optionally, append the one of four segmentation methods to define
714+
the group:
715+
716+
- **a** : Ignore all segment headers, i.e., let all points belong
717+
to a single group, and set group reference point to the very
718+
first point of the first file.
719+
- **f** : Consider all data in each file to be a single separate
720+
group and reset the group reference point to the first point of
721+
each group.
722+
- **s** : Segment headers are honored so each segment is a group;
723+
the group reference point is reset to the first point of each
724+
incoming segment [Default].
725+
- **r** : Same as **s**, but the group reference point is reset
726+
after each record to the previous point (this method is only
727+
available with the ``connection='r'`` scheme).
728+
729+
Instead of the codes **a**|**f**|**s**|**r** you may append the
730+
coordinates of a *refpoint* which will serve as a fixed external
731+
reference point for all groups.
686732
{G}
733+
intensity : float or bool
734+
Provide an *intens* value (nominally in the -1 to +1 range) to
735+
modulate the fill color by simulating illumination [None]. If
736+
using ``intensity=True``, we will instead read *intens* from the
737+
first data column after the symbol parameters (if given).
738+
close : str
739+
``[+b|d|D][+xl|r|x0][+yl|r|y0][+ppen]``.
740+
Force closed polygons. Full documentation is at
741+
:gmt-docs:`plot.html#l`.
687742
no_clip : bool or str
688743
``'[c|r]'``.
689744
Do NOT clip symbols that fall outside map border [Default plots
@@ -703,6 +758,15 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
703758
{U}
704759
{V}
705760
{XY}
761+
zvalue : str
762+
``value|file``.
763+
Instead of specifying a symbol or polygon fill and outline color
764+
via **color** and **pen**, give both a *value* via **zvalue** and a
765+
color lookup table via **cmap**. Alternatively, give the name of a
766+
*file* with one z-value (read from the last column) for each
767+
polygon in the input data. To apply it to the fill color, use
768+
``color='+z'``. To apply it to the pen color, append **+z** to
769+
**pen**.
706770
label : str
707771
Add a legend entry for the symbol or line being plotted.
708772

0 commit comments

Comments
 (0)