Skip to content

Commit 903b8dc

Browse files
authored
Let the frame parameter accept "none" to not plot frames (#4404)
1 parent 599c019 commit 903b8dc

27 files changed

Lines changed: 64 additions & 30 deletions

examples/gallery/maps/choropleth_map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
africa = world[world["CONTINENT"] == "Africa"].copy()
2828

2929
fig = pygmt.Figure()
30-
fig.basemap(region=[-19.5, 53, -37.5, 38], projection="M10c", frame="+n")
30+
fig.basemap(region=[-19.5, 53, -37.5, 38], projection="M10c", frame="none")
3131

3232
# First, we define the colormap to fill the polygons based on the "POP_EST" column.
3333
pygmt.makecpt(cmap="SCM/acton", series=(0, 100), reverse=True)

pygmt/alias.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,9 @@ def add_common(self, **kwargs): # noqa: PLR0912
338338
for key, value in kwargs.items():
339339
match key:
340340
case "B":
341-
alias = Alias(value, name="frame")
341+
# Mapping frame="none" to '-B+n'.
342+
_value = "+n" if value == "none" else value
343+
alias = Alias(_value, name="frame")
342344
case "J":
343345
alias = Alias(value, name="projection")
344346
case "R":

pygmt/helpers/decorators.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,12 @@
9090
that do not match the pattern. Append **i** for case insensitive
9191
matching. This does not apply to headers or segment headers.""",
9292
"frame": r"""
93-
frame : bool, str, or list
94-
Set map boundary
95-
:doc:`frame and axes attributes </tutorials/basics/frames>`.""",
93+
frame
94+
Set frame and axes attributes for the plot. It can be a bool, a string, or
95+
a list of strings. If ``frame=True``, frame will be drawn with the default
96+
attributes. If ``frame="none"``, no frame will be drawn. A tutorial is
97+
available at :doc:`frame and axes attributes </tutorials/basics/frames>`.
98+
Full documentation is at :gmt-docs:`gmt.html#b-full`.""",
9699
"gap": r"""
97100
gap : str or list
98101
**x**\|\ **y**\|\ **z**\|\ **d**\|\ **X**\|\ **Y**\|\

pygmt/src/basemap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def basemap( # noqa: PLR0913
1818
zscale: float | str | None = None,
1919
zsize: float | str | None = None,
2020
region: Sequence[float | str] | str | None = None,
21-
frame: str | Sequence[str] | bool = False,
21+
frame: str | Sequence[str] | Literal["none"] | bool = False,
2222
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
2323
| bool = False,
2424
map_scale: str | None = None,

pygmt/src/coast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def coast( # noqa: PLR0913
3030
box: Box | bool = False,
3131
projection: str | None = None,
3232
region: Sequence[float | str] | str | None = None,
33-
frame: str | Sequence[str] | bool = False,
33+
frame: str | Sequence[str] | Literal["none"] | bool = False,
3434
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3535
| bool = False,
3636
panel: int | Sequence[int] | bool = False,

pygmt/src/colorbar.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def colorbar( # noqa: PLR0913
168168
scale: float | None = None,
169169
projection: str | None = None,
170170
region: Sequence[float | str] | str | None = None,
171-
frame: str | Sequence[str] | bool = False,
171+
frame: str | Sequence[str] | Literal["none"] | bool = False,
172172
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
173173
| bool = False,
174174
panel: int | Sequence[int] | bool = False,
@@ -322,7 +322,8 @@ def colorbar( # noqa: PLR0913
322322
$projection
323323
$region
324324
frame
325-
Set colorbar boundary frame, labels, and axes attributes.
325+
Set colorbar boundary frame, labels, and axes attributes. If set to ``"none"``,
326+
then no frame will be drawn.
326327
$verbose
327328
$panel
328329
$perspective

pygmt/src/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def contour( # noqa: PLR0913
4040
no_clip: bool = False,
4141
projection: str | None = None,
4242
region: Sequence[float | str] | str | None = None,
43-
frame: str | Sequence[str] | bool = False,
43+
frame: str | Sequence[str] | Literal["none"] | bool = False,
4444
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4545
| bool = False,
4646
panel: int | Sequence[int] | bool = False,

pygmt/src/grdcontour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def grdcontour(
4040
grid: PathLike | xr.DataArray,
4141
projection: str | None = None,
4242
region: Sequence[float | str] | str | None = None,
43-
frame: str | Sequence[str] | bool = False,
43+
frame: str | Sequence[str] | Literal["none"] | bool = False,
4444
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4545
| bool = False,
4646
panel: int | Sequence[int] | bool = False,

pygmt/src/grdimage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def grdimage( # noqa: PLR0913
3232
no_clip: bool = False,
3333
projection: str | None = None,
3434
region: Sequence[float | str] | str | None = None,
35-
frame: str | Sequence[str] | bool = False,
35+
frame: str | Sequence[str] | Literal["none"] | bool = False,
3636
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3737
| bool = False,
3838
panel: int | Sequence[int] | bool = False,

pygmt/src/grdview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def grdview( # noqa: PLR0913
135135
zscale: float | str | None = None,
136136
zsize: float | str | None = None,
137137
region: Sequence[float | str] | str | None = None,
138-
frame: str | Sequence[str] | bool = False,
138+
frame: str | Sequence[str] | Literal["none"] | bool = False,
139139
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
140140
| bool = False,
141141
panel: int | Sequence[int] | bool = False,

0 commit comments

Comments
 (0)