GeezerVison is showing github.com — Figure.basemap/Figure.coast: Deprecate the 'map_scale' parameter. Use… · GenericMappingTools/pygmt@958c936
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: pygmt/src/basemap.py +20-17Lines changed: 20 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 |
| 12 | 12 |
| 13 | 13 | @fmt_docstring | 14 | | -@use_alias( | 15 | | - L="map_scale", | 16 | | - F="box", | 17 | | - Td="rose", | 18 | | - Tm="compass", | 19 | | - f="coltypes", | 20 | | -) | 21 | | -def basemap( | | 14 | +@use_alias(F="box", Td="rose", Tm="compass", f="coltypes") | | 15 | +def basemap( # noqa: PLR0913 | 22 | 16 | self, | 23 | 17 | projection: str | None = None, | 24 | 18 | zsize: float | str | None = None, | 25 | 19 | zscale: float | str | None = None, | 26 | 20 | frame: str | Sequence[str] | bool = False, | 27 | 21 | region: Sequence[float | str] | str | None = None, | | 22 | + map_scale: str | None = None, | 28 | 23 | verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"] | 29 | 24 | | bool = False, | 30 | 25 | panel: int | Sequence[int] | bool = False, | @@ -35,13 +30,16 @@ def basemap( | 35 | 30 | r""" | 36 | 31 | Plot base maps and frames. | 37 | 32 |
| 38 | | - Creates a basic or fancy basemap with axes, fill, and titles. Several | 39 | | - map projections are available, and the user may specify separate | 40 | | - tick-mark intervals for boundary annotation, ticking, and [optionally] | 41 | | - gridlines. A simple map scale or directional rose may also be plotted. | | 33 | + Creates a basic or fancy basemap with axes, fill, and titles. Several map | | 34 | + projections are available, and the user may specify separate tick-mark intervals for | | 35 | + boundary annotation, ticking, and [optionally] gridlines. | 42 | 36 |
| 43 | | - At least one of the parameters ``frame``, ``map_scale``, ``rose``, or | 44 | | - ``compass`` must be specified if not in subplot mode. | | 37 | + At least one of the parameters ``frame``, ``map_scale``, ``rose``, or ``compass`` | | 38 | + must be specified if not in subplot mode. | | 39 | +
| | 40 | + See also the following methods that wraps the GMT's ``basemap`` module: | | 41 | +
| | 42 | + - :meth:`pygmt.Figure.scalebar`: Add a scale bar on the plot. | 45 | 43 |
| 46 | 44 | Full GMT docs at :gmt-docs:`basemap.html`. | 47 | 45 |
| @@ -50,6 +48,7 @@ def basemap( | 50 | 48 | - J = projection | 51 | 49 | - Jz = zscale | 52 | 50 | - JZ = zsize | | 51 | + - L = map_scale | 53 | 52 | - R = region | 54 | 53 | - V = verbose | 55 | 54 | - c = panel | @@ -64,10 +63,13 @@ def basemap( | 64 | 63 | $region | 65 | 64 | *Required if this is the first plot command.* | 66 | 65 | $frame | 67 | | - map_scale : str | 68 | | - [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ | 69 | | - **+w**\ *length*. | | 66 | + map_scale | 70 | 67 | Draw a simple map scale centered on the reference point specified. | | 68 | +
| | 69 | + .. deprecated:: v0.19.0 | | 70 | +
| | 71 | + Recommended to use :meth:`pygmt.Figure.scalebar` instead. | | 72 | +
| 71 | 73 | box : bool or str | 72 | 74 | [**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\ *pen*]]\ | 73 | 75 | [**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\ [[*dx*/*dy*/][*shade*]]]. | @@ -103,6 +105,7 @@ def basemap( | 103 | 105 | aliasdict = AliasSystem( | 104 | 106 | Jz=Alias(zscale, name="zscale"), | 105 | 107 | JZ=Alias(zsize, name="zsize"), | | 108 | + L=Alias(map_scale, name="map_scale"), # Deprecated. | 106 | 109 | ).add_common( | 107 | 110 | B=frame, | 108 | 111 | J=projection, | |
Collapse file Copy file name to clipboardExpand all lines: pygmt/src/coast.py +8-3Lines changed: 8 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 |
| 16 | 16 |
| 17 | 17 | @fmt_docstring | 18 | | -@use_alias(A="area_thresh", C="lakes", E="dcw", L="map_scale") | | 18 | +@use_alias(A="area_thresh", C="lakes", E="dcw") | 19 | 19 | def coast( # noqa: PLR0913 | 20 | 20 | self, | 21 | 21 | resolution: Literal[ | @@ -26,6 +26,7 @@ def coast( # noqa: PLR0913 | 26 | 26 | rivers: int | str | Sequence[int | str] | None = None, | 27 | 27 | borders: int | str | Sequence[int | str] | None = None, | 28 | 28 | shorelines: bool | str | Sequence[int | str] = False, | | 29 | + map_scale: str | None = None, | 29 | 30 | box: Box | bool = False, | 30 | 31 | projection: str | None = None, | 31 | 32 | frame: str | Sequence[str] | bool = False, | @@ -131,9 +132,12 @@ def coast( # noqa: PLR0913 | 131 | 132 | - ``rivers=["1/0.5p,blue", "5/0.3p,cyan,dashed"]``: Draw permanent major rivers | 132 | 133 | with a 0.5-point blue pen and intermittent major rivers with a 0.3-point | 133 | 134 | dashed cyan pen. | 134 | | - map_scale : str | 135 | | - [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ **+w**\ *length*. | | 135 | + map_scale | 136 | 136 | Draw a simple map scale centered on the reference point specified. | | 137 | +
| | 138 | + .. deprecated:: v0.19.0 | | 139 | +
| | 140 | + Recommended to use :meth:`pygmt.Figure.scalebar` instead. | 137 | 141 | box | 138 | 142 | Draw a background box behind the map scale or rose. If set to ``True``, a simple | 139 | 143 | rectangular box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box | @@ -256,6 +260,7 @@ def coast( # noqa: PLR0913 | 256 | 260 | F=Alias(box, name="box"), | 257 | 261 | G=Alias(land, name="land"), | 258 | 262 | I=Alias(rivers, name="rivers"), | | 263 | + L=Alias(map_scale, name="map_scale"), # Deprecated. | 259 | 264 | N=Alias(borders, name="borders"), | 260 | 265 | S=Alias(water, name="water"), | 261 | 266 | W=Alias(shorelines, name="shorelines"), | |
|