pygmt.Figure.plot

Figure.plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs)

Plot lines, polygons, and symbols on maps.

Used to be psxy.

Takes a matrix, (x,y) pairs, or a file name as input and plots lines, polygons, or symbols at those locations on a map.

Must provide either data or x and y.

If providing data through x and y, color (G) can be a 1d array that will be mapped to a colormap.

If a symbol is selected and no symbol size given, then psxy will interpret the third column of the input data as symbol size. Symbols whose size is <= 0 are skipped. If no symbols are specified then the symbol code (see S below) must be present as last column in the input. If S is not used, a line connecting the data points will be drawn instead. To explicitly close polygons, use L. Select a fill with G. If G is set, W will control whether the polygon outline is drawn or not. If a symbol is selected, G and W determines the fill and outline/no outline, respectively.

Full option list at https://www.generic-mapping-tools.org/gmt/latest/plot.html

Aliases:

  • B = frame

  • C = cmap

  • G = color

  • J = projection

  • R = region

  • S = style

  • W = pen

  • i = columns

Parameters
x, y1d arrays

Arrays of x and y coordinates of the data points.

datastr or 2d array

Either a data file name or a 2d numpy array with the tabular data. Use option columns (i) to choose which columns are x, y, color, and size, respectively.

sizes1d array

The sizes of the data points in units specified in style (S). Only valid if using x and y.

directionlist of two 1d arrays

If plotting vectors (using style='V' or style='v'), then should be a list of two 1d arrays with the vector directions. These can be angle and length, azimuth and length, or x and y components, depending on the style options chosen.

Jstr

Required if this is the first plot command. Select map projection.

Rstr or list

Required if this is the first plot command. 'xmin/xmax/ymin/ymax[+r][+uunit]'. Specify the region of interest.

Abool or str

'[m|p|x|y]' By default, geographic line segments are drawn as great circle arcs. To draw them as straight lines, use A.

Bstr

Set map boundary frame and axes attributes.

Cstr

File name of a CPT file or C='color1,color2[,color3,...]' to build a linear continuous CPT from those colors automatically.

Dstr

'dx/dy': Offset the plot symbol or line locations by the given amounts dx/dy.

Ebool or str

'[x|y|X|Y][+a][+cl|f][+n][+wcap][+ppen]'. Draw symmetrical error bars.

Gstr

Select color or pattern for filling of symbols or polygons. Default is no fill.

Sstr

Plot symbols (including vectors, pie slices, fronts, decorated or quoted lines).

Wstr

Set pen attributes for lines or the outline of symbols.

Ubool or str

Draw GMT time stamp logo on plot.