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, y : 1d arrays

Arrays of x and y coordinates of the data points.

data : str 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.

sizes : 1d array

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

direction : list 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.

J : str

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

R : str or list

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

A : bool 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.

B : str

Set map boundary frame and axes attributes.

C : str

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

D : str

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

E : bool or str

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

G : str

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

S : str

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

W : str

Set pen attributes for lines or the outline of symbols.

U : bool or str

Draw GMT time stamp logo on plot.