Images on figuresΒΆ

The pygmt.Figure.image method can be used to read and place an image file in many formats (e.g., png, jpg, eps, pdf) on a figure. We must specify the filename via the imagefile parameter or simply use the filename as the first argument. You can also use a full URL pointing to your desired image. The position parameter allows us to set a reference point on the map for the image.



image [NOTICE]:   -> Download URL file:

<IPython.core.display.Image object>

import os

import pygmt

fig = pygmt.Figure()
fig.basemap(region=[0, 2, 0, 2], projection="X10c", frame=True)

# place and center the GMT logo from the GMT website to the position 1/1
# on a basemap, scaled up to be 3 cm wide and draw a rectangular border
# around the image

# clean up the downloaded image in the current directory

Total running time of the script: ( 0 minutes 1.555 seconds)

Gallery generated by Sphinx-Gallery