pygmt.Figure.text

Figure.text(textfiles=None, x=None, y=None, text=None, angle=None, font=None, justify=None, **kwargs)

Plot or typeset text on maps

Used to be pstext.

Takes in textfile(s) or (x,y,text) triples as input.

Must provide at least textfiles or x, y, and text.

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

Aliases:

  • B = frame

  • J = projection

  • R = region

  • W = pen

Parameters
  • textfiles (str or list) – A text data file name, or a list of filenames containing 1 or more records with (x, y[, font, angle, justify], text).

  • x/y (float or 1d arrays) – The x and y coordinates, or an array of x and y coordinates to plot the text

  • text (str or 1d array) – The text string, or an array of strings to plot on the figure

  • angle (int, float, str or bool) – Set the angle measured in degrees counter-clockwise from horizontal. E.g. 30 sets the text at 30 degrees. If no angle is explicitly given (i.e. angle=True) then the input textfile(s) must have this as a column.

  • font (str or bool) – Set the font specification with format “size,font,color” where size is text size in points, font is the font to use, and color sets the font color. E.g. “12p,Helvetica-Bold,red” selects a 12p red Helvetica-Bold font. If no font info is explicitly given (i.e. font=True), then the input textfile(s) must have this information in one of its columns.

  • justify (str or bool) – Set the alignment which refers to the part of the text string that will be mapped onto the (x,y) point. Choose a 2 character combination of L, C, R (for left, center, or right) and T, M, B for top, middle, or bottom. E.g., BL for lower left. If no justification is explicitly given (i.e. justify=True), then the input textfile(s) must have this as a column.

  • projection (str) – Required if this is the first plot command. Select map projection.

  • region (str or list) – Required if this is the first plot command. 'xmin/xmax/ymin/ymax[+r][+uunit]'. Specify the region of interest.

  • pen (str) – Sets the pen used to draw a rectangle around the text string (see clearance) [Default is width = default, color = black, style = solid].