GeezerVison is showing github.com — Figure.basemap/Figure.coast: Deprecate the 'map_scale' parameter. Use… · GenericMappingTools/pygmt@9e2b9f4
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 +29-18Lines changed: 29 additions & 18 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,17 @@ 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 provide higher-level interfaces to the GMT's | | 41 | + ``basemap`` module: | | 42 | +
| | 43 | + - :meth:`pygmt.Figure.scalebar`: Add a scale bar on the plot. | 45 | 44 |
| 46 | 45 | Full GMT docs at :gmt-docs:`basemap.html`. | 47 | 46 |
| @@ -50,6 +49,7 @@ def basemap( | 50 | 49 | - J = projection | 51 | 50 | - Jz = zscale | 52 | 51 | - JZ = zsize | | 52 | + - L = map_scale | 53 | 53 | - R = region | 54 | 54 | - V = verbose | 55 | 55 | - c = panel | @@ -64,10 +64,20 @@ def basemap( | 64 | 64 | $region | 65 | 65 | *Required if this is the first plot command.* | 66 | 66 | $frame | 67 | | - map_scale : str | 68 | | - [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ | 69 | | - **+w**\ *length*. | 70 | | - Draw a simple map scale centered on the reference point specified. | | 67 | + map_scale | | 68 | + Draw a map scale bar on the plot. | | 69 | +
| | 70 | + .. deprecated:: v0.19.0 | | 71 | +
| | 72 | + The ``map_scale`` parameter is deprecated. Use :meth:`pygmt.Figure.scalebar` | | 73 | + instead, which provides a more comprehensive and flexible API for adding | | 74 | + scale bars to plots. | | 75 | +
| | 76 | + .. note:: | | 77 | +
| | 78 | + This parameter accepts raw GMT CLI strings for the ``-L`` option of | | 79 | + the ``basemap`` module for backward compatibility. | | 80 | +
| 71 | 81 | box : bool or str | 72 | 82 | [**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\ *pen*]]\ | 73 | 83 | [**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\ [[*dx*/*dy*/][*shade*]]]. | @@ -103,6 +113,7 @@ def basemap( | 103 | 113 | aliasdict = AliasSystem( | 104 | 114 | Jz=Alias(zscale, name="zscale"), | 105 | 115 | JZ=Alias(zsize, name="zsize"), | | 116 | + L=Alias(map_scale, name="map_scale"), # Deprecated. | 106 | 117 | ).add_common( | 107 | 118 | B=frame, | 108 | 119 | J=projection, | |
Collapse file Copy file name to clipboardExpand all lines: pygmt/src/coast.py +18-4Lines changed: 18 additions & 4 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, | @@ -63,6 +64,7 @@ def coast( # noqa: PLR0913 | 63 | 64 | - G = land | 64 | 65 | - I = rivers | 65 | 66 | - J = projection | | 67 | + - L = map_scale | 66 | 68 | - R = region | 67 | 69 | - S = water | 68 | 70 | - V = verbose | @@ -131,9 +133,20 @@ def coast( # noqa: PLR0913 | 131 | 133 | - ``rivers=["1/0.5p,blue", "5/0.3p,cyan,dashed"]``: Draw permanent major rivers | 132 | 134 | with a 0.5-point blue pen and intermittent major rivers with a 0.3-point | 133 | 135 | dashed cyan pen. | 134 | | - map_scale : str | 135 | | - [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ **+w**\ *length*. | 136 | | - Draw a simple map scale centered on the reference point specified. | | 136 | + map_scale | | 137 | + Draw a map scale bar on the plot. | | 138 | +
| | 139 | + .. deprecated:: v0.19.0 | | 140 | +
| | 141 | + The ``map_scale`` parameter is deprecated. Use :meth:`pygmt.Figure.scalebar` | | 142 | + instead, which provides a more comprehensive and flexible API for adding | | 143 | + scale bars to plots. | | 144 | +
| | 145 | + .. note:: | | 146 | +
| | 147 | + This parameter accepts raw GMT CLI strings for the ``-L`` option of | | 148 | + the ``basemap`` module for backward compatibility. | | 149 | +
| 137 | 150 | box | 138 | 151 | Draw a background box behind the map scale or rose. If set to ``True``, a simple | 139 | 152 | rectangular box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box | @@ -256,6 +269,7 @@ def coast( # noqa: PLR0913 | 256 | 269 | F=Alias(box, name="box"), | 257 | 270 | G=Alias(land, name="land"), | 258 | 271 | I=Alias(rivers, name="rivers"), | | 272 | + L=Alias(map_scale, name="map_scale"), # Deprecated. | 259 | 273 | N=Alias(borders, name="borders"), | 260 | 274 | S=Alias(water, name="water"), | 261 | 275 | W=Alias(shorelines, name="shorelines"), | |
|