pygmt.Figure.plot

Figure.plot(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 can be a 1d array that will be mapped to a colormap.

If a symbol is selected and no symbol size given, then plot 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 symbol below) must be present as last column in the input. If symbol is not used, a line connecting the data points will be drawn instead. To explicitly close polygons, use close. Select a fill with color. If color is set, pen will control whether the polygon outline is drawn or not. If a symbol is selected, color and pen determines the fill and outline/no outline, respectively.

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

Aliases:

  • A = straight_lines

  • B = frame

  • C = cmap

  • D = position

  • E = error_bars

  • G = color

  • J = projection

  • L = close

  • R = region

  • S = style

  • W = pen

  • i = columns

  • l = label

Parameters
  • x/y (float or 1d arrays) – The x and y coordinates, or 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.

  • straight_lines (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 straight_lines.

  • B (str or list) – 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.

  • position (str) – 'dx/dy': Offset the plot symbol or line locations by the given amounts dx/dy.

  • error_bars (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.

  • style (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.

  • columns (list or str) – cols[+l][+sscale][+ooffset][,…][,t[word]] Select input columns and transformations (0 is first column, t is trailing text, append word to read one word only).

  • label (str) – Add a legend entry for the symbol or line being plotted.