Plotting lines is handled by
Create a Cartesian figure using
projection parameter and set the axis
region (in this case, each axis is 0-10). Pass a list of
y values to be plotted as a line.
Additional line segments can be added by including additional values for
To plot multiple lines,
pygmt.Figure.plot needs to be used for each
additional line. Parameters such as
do not need to be repeated in subsequent uses.
Change line attributes
The line attributes can be set by the
pen takes a
string argument with the optional values width,color,style.
In the example below, the pen width is set to
5p, and with
the default color and
solid as the default style.
The line color can be set and is added after the line width to the
parameter. In the example below, the line color is set to
The line style can be set and is added after the line width or color to the
pen parameter. In the example below, the line style is set to
..- (dot dot dash), and the default color
black is used.
The line width, color, and style can all be set in the same
parameter. In the example below, the line width is set to
7p, the color
is set to
green, and the line style is
-.- (dash dot dash).
For a gallery showing other
pen settings, see
Total running time of the script: (0 minutes 3.701 seconds)