pygmt.Figure.image

Figure.image(imagefile, *, position=None, box=None, bitcolor=None, projection=None, monochrome=None, region=None, verbose=None, panel=None, perspective=None, transparency=None, **kwargs)

Place images or EPS files on maps.

Reads an Encapsulated PostScript file or a raster image file and plots it on a map.

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

Aliases:

  • D = position

  • F = box

  • G = bitcolor

  • J = projection

  • M = monochrome

  • R = region

  • V = verbose

  • c = panel

  • p = perspective

  • t = transparency

Parameters
  • imagefile (str) – This must be an Encapsulated PostScript (EPS) file or a raster image. An EPS file must contain an appropriate BoundingBox. A raster file can have a depth of 1, 8, 24, or 32 bits and is read via GDAL. Note: If GDAL was not configured during GMT installation then only EPS files are supported.

  • projection (str) – projcode[projparams/]width. Select map projection.

  • region (str or list) – xmin/xmax/ymin/ymax[+r][+uunit]. Specify the region of interest.

  • position (str) – [g|j|J|n|x]refpoint+rdpi+w[-]width[/height][+jjustify][+nnx[/ny] ][+odx[/dy]]. Set reference point on the map for the image.

  • box (bool or str) – [+cclearances][+gfill][+i[[gap/]pen]][+p[pen]][+r[radius]][+s[[dx/dy/][shade]]]. If set to True, draw a rectangular border around the image using MAP_FRAME_PEN.

  • bitcolor (str or list) – [color][+b|f|t]. Change certain pixel values to another color or make them transparent. For 1-bit images you can specify an alternate color for the background (+b) or the foreground (+f) pixels, or give no color to make those pixels transparent. Can be repeated with different settings. Alternatively, for color images you can select a single color that should be made transparent instead (+t).

  • monochrome (bool) – Convert color image to monochrome grayshades using the (television) YIQ-transformation.

  • verbose (bool or str) –

    Select verbosity level [Default is w], which modulates the messages written to stderr. Choose among 7 levels of verbosity:

    • q - Quiet, not even fatal error messages are produced

    • e - Error messages only

    • w - Warnings [Default]

    • t - Timings (report runtimes for time-intensive algorithms)

    • i - Informational messages (same as verbose=True)

    • c - Compatibility warnings

    • d - Debugging messages

  • panel (bool or int or list) – [row,col|index]. Select a specific subplot panel. Only allowed when in subplot mode. Use panel=True to advance to the next panel in the selected order. Instead of row,col you may also give a scalar value index which depends on the order you set via autolabel when the subplot was defined. Note: row, col, and index all start at 0.

  • perspective (list or str) – [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]. Select perspective view and set the azimuth and elevation angle of the viewpoint [Default is [180, 90]]. Full documentation is at https://docs.generic-mapping-tools.org/latest/gmt.html#perspective-full.

  • transparency (int or float) – Set transparency level, in [0-100] percent range [Default is 0, i.e., opaque]. Only visible when PDF or raster format output is selected. Only the PNG format selection adds a transparency layer in the image (for further processing).

Examples using pygmt.Figure.image

Images on figures

Images on figures