|
1 | 1 | """
|
2 |
| -Images or EPS files on maps |
3 |
| ---------------------------- |
4 |
| -The :meth:`pygmt.Figure.image` method can be used to read and |
5 |
| -place a raster image file or an Encapsulated PostScript file |
6 |
| -on a map. We must specify the file as *str* via the ``imagefile`` |
7 |
| -parameter or simply use the filename as the first argument. You can |
8 |
| -also use a full URL pointing to your desired image. The ``position`` |
9 |
| -parameter allows us to set a reference point on the map for the image. |
10 |
| -
|
| 2 | +Images on figures |
| 3 | +----------------- |
| 4 | +The :meth:`pygmt.Figure.image` method can be used to read and place an image |
| 5 | +file in many formats (e.g., png, jpg, eps, pdf) on a figure. We must specify |
| 6 | +the filename via the ``imagefile`` parameter or simply use the filename as |
| 7 | +the first argument. You can also use a full URL pointing to your desired image. |
| 8 | +The ``position`` parameter allows us to set a reference point on the map for |
| 9 | +the image. |
11 | 10 | """
|
12 | 11 | import os
|
13 | 12 |
|
14 | 13 | import pygmt
|
15 | 14 |
|
16 | 15 | fig = pygmt.Figure()
|
17 |
| - |
18 |
| -fig.basemap(region=[0, 2, 0, 2], projection="X6c", frame=True) |
| 16 | +fig.basemap(region=[0, 2, 0, 2], projection="X10c", frame=True) |
19 | 17 |
|
20 | 18 | # place and center the GMT logo from the GMT website to the position 1/1
|
21 |
| -# on a basemap and draw a rectangular border around the image |
| 19 | +# on a basemap, scaled up to be 3 cm wide and draw a rectangular border |
| 20 | +# around the image |
22 | 21 | fig.image(
|
23 | 22 | imagefile="https://www.generic-mapping-tools.org/_static/gmt-logo.png",
|
24 | 23 | position="g1/1+w3c+jCM",
|
|
0 commit comments