@@ -19,19 +19,19 @@ def image( # noqa: PLR0913
1919 self ,
2020 imagefile : PathLike ,
2121 position : Position | None = None ,
22- height : float | str | None = None ,
2322 width : float | str | None = None ,
24- replicate : int | Sequence [ int ] | None = None ,
23+ height : float | str | None = None ,
2524 dpi : float | str | None = None ,
25+ replicate : int | Sequence [int ] | None = None ,
2626 box : Box | bool = False ,
2727 monochrome : bool = False ,
2828 projection : str | None = None ,
2929 region : Sequence [float | str ] | str | None = None ,
3030 verbose : Literal ["quiet" , "error" , "warning" , "timing" , "info" , "compat" , "debug" ]
3131 | bool = False ,
3232 panel : int | Sequence [int ] | bool = False ,
33- transparency : float | None = None ,
3433 perspective : float | Sequence [float ] | str | bool = False ,
34+ transparency : float | None = None ,
3535 ** kwargs ,
3636):
3737 r"""
@@ -70,8 +70,8 @@ def image( # noqa: PLR0913
7070 contain an appropriate BoundingBox. A raster file can have a depth of 1, 8, 24,
7171 or 32 bits and is read via GDAL.
7272 position
73- Specify the position of the image on the plot. See
74- :class:`pygmt.params.Position` for details.
73+ Position of the image on the plot. Pass a :class:`pygmt.params.Position` object
74+ to specify the location, anchor, and offset. [Default is at the plot origin.]
7575 width
7676 height
7777 Width (and height) of the image in plot coordinates (inches, cm, etc.). If
@@ -124,6 +124,14 @@ def image( # noqa: PLR0913
124124 )
125125 raise GMTInvalidInput (msg )
126126
127+ # width is required when only height is given.
128+ if width is None and height is not None :
129+ width = 0
130+
131+ # Default position at the plot origin.
132+ if position is None :
133+ position = Position ((0 , 0 ), cstype = "plotcoords" )
134+
127135 aliasdict = AliasSystem (
128136 D = [
129137 Alias (position , name = "position" ),
0 commit comments