Skip to content

Commit 28be123

Browse files
committed
Rename reversed to invert
1 parent f627d28 commit 28be123

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

examples/gallery/symbols/patterns.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
Theses patterns can be specified via the :class:`pygmt.params.Pattern` class. The
2626
patterns can be customized with different resolution and different foreground and
27-
background colors. The foreground and background colors can also be reversed.
27+
background colors. The foreground and background colors can also be inverted.
2828
"""
2929

3030
# %%
@@ -41,7 +41,7 @@
4141
# Pattern 19 with custom background ("red3") and foreground ("lightbrown").
4242
Pattern(19, bgcolor="red3", fgcolor="lightbrown"),
4343
# Reverse the background and foreground.
44-
Pattern(19, reversed=True, bgcolor="red3", fgcolor="lightbrown"),
44+
Pattern(19, invert=True, bgcolor="red3", fgcolor="lightbrown"),
4545
# Same as above, but with a 100 dpi resolution.
4646
Pattern(19, bgcolor="red3", fgcolor="lightbrown", dpi=100),
4747
# Same as above, but with a transparent background by setting bgcolor to "".

pygmt/params/pattern.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Pattern(BaseParam):
2121
24-bit image raster files to fill symbols and polygons in various PyGMT plotting
2222
methods. The patterns can be customized with different resolution and different
2323
foreground and background colors. The foreground and background colors can also be
24-
reversed.
24+
inverted.
2525
2626
GMT provides 90 predefined patterns that can be used in PyGMT. The patterns are
2727
numbered from 1 to 90, and shown below:
@@ -47,8 +47,8 @@ class Pattern(BaseParam):
4747
[Default is white for background and black for foreground]. Setting either to
4848
an empty string will yield a transparent background/foreground where only the
4949
foreground or background pixels will be painted.
50-
reversed
51-
If ``True``, the pattern will be bit-reversed, i.e., white and black areas will
50+
invert
51+
If ``True``, the pattern will be bit-inverted, i.e., white and black areas will
5252
be interchanged (only applies to predefined bit-patterns or 1-bit images).
5353
5454
Examples
@@ -73,7 +73,7 @@ class Pattern(BaseParam):
7373
dpi: int | None = None
7474
bgcolor: str | None = None
7575
fgcolor: str | None = None
76-
reversed: bool = False
76+
invert: bool = False
7777

7878
def _validate(self):
7979
"""
@@ -104,7 +104,7 @@ def _aliases(self):
104104
Aliases for the Pattern class.
105105
"""
106106
return [
107-
Alias(self.pattern, name="pattern", prefix="P" if self.reversed else "p"),
107+
Alias(self.pattern, name="pattern", prefix="P" if self.invert else "p"),
108108
Alias(self.bgcolor, name="bgcolor", prefix="+b"),
109109
Alias(self.fgcolor, name="fgcolor", prefix="+f"),
110110
Alias(self.dpi, name="dpi", prefix="+r"),

pygmt/tests/test_params_pattern.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def test_pattern():
2424

2525
assert str(Pattern(40, dpi=300)) == "p40+r300"
2626

27-
assert str(Pattern(50, reversed=True)) == "P50"
27+
assert str(Pattern(50, invert=True)) == "P50"
2828

29-
pattern = Pattern(90, reversed=True, bgcolor="red", fgcolor="blue", dpi=300)
29+
pattern = Pattern(90, invert=True, bgcolor="red", fgcolor="blue", dpi=300)
3030
assert str(pattern) == "P90+bred+fblue+r300"
3131

3232
pattern = Pattern("pattern.png", bgcolor="red", fgcolor="blue", dpi=300)
@@ -42,6 +42,7 @@ def test_pattern_invalid_pattern():
4242
with pytest.raises(GMTValueError):
4343
_ = str(Pattern(91))
4444

45+
4546
def test_pattern_invalid_colors():
4647
"""
4748
Test that both fgcolor and bgcolor cannot be empty strings.

0 commit comments

Comments
 (0)