Skip to content

Commit 37ed709

Browse files
committed
Use Box in examples and tests
1 parent f57d3d9 commit 37ed709

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

examples/gallery/embellishments/inset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# %%
1212
import pygmt
13+
from pygmt.params import Box
1314

1415
fig = pygmt.Figure()
1516
# Create the primary figure, setting the region to Madagascar, the land color
@@ -19,7 +20,7 @@
1920
# Create an inset, placing it in the Top Left (TL) corner with a width of 3.5 cm and
2021
# x- and y-offsets of 0.2 cm. The margin is set to 0, and the border is "gold" with a
2122
# pen size of 1.5 points.
22-
with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+p1.5p,gold"):
23+
with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box=Box(pen="1.5p,gold")):
2324
# Create a figure in the inset using coast. This example uses the azimuthal
2425
# orthogonal projection centered at 47E, 20S. The land color is set to
2526
# "gray" and Madagascar is highlighted in "red3".

examples/gallery/embellishments/inset_rectangle_region.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# %%
1212
import pygmt
13+
from pygmt.params import Box
1314

1415
# Set the region of the main figure
1516
region = [137.5, 141, 34, 37]
@@ -34,7 +35,7 @@
3435
# a pen of "1p".
3536
with fig.inset(
3637
position="jBR+o0.1c",
37-
box="+gwhite+p1p",
38+
box=Box(fill="white", pen="1p"),
3839
region=[129, 146, 30, 46],
3940
projection="U54S/3c",
4041
):

examples/gallery/embellishments/scalebar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
# %%
4646
import pygmt
47+
from pygmt.params import Box
4748

4849
# Create a new Figure instance
4950
fig = pygmt.Figure()
@@ -105,7 +106,7 @@
105106
# Fill the box in white with a transparency of 30 percent, add a solid
106107
# outline in darkgray (gray30) with a thickness of 0.5 points, and use
107108
# rounded edges with a radius of 3 points
108-
box="+gwhite@30+p0.5p,gray30,solid+r3p",
109+
box=Box(fill="white@30", pen="0.5p,gray30,solid", radius="3p"),
109110
)
110111

111112
fig.show()

examples/tutorials/advanced/legends.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io
1111

1212
import pygmt
13+
from pygmt.params import Box
1314

1415
# %%
1516
# Create an auto-legend
@@ -90,7 +91,7 @@
9091

9192
# Add a box with a 2-points thick blue, solid outline and a white fill with a
9293
# transparency of 70 percentage ("@30").
93-
fig.legend(position="jTL+o0.3c/0.2c", box="+p2p,blue+gwhite@30")
94+
fig.legend(position="jTL+o0.3c/0.2c", box=Box(pen="2p,blue", fill="white@30"))
9495

9596
fig.show()
9697

@@ -152,7 +153,7 @@
152153
fig.basemap(region=[-5, 5, -5, 5], projection="M10c", frame=True)
153154

154155
# Pass the io.StringIO object to the "spec" parameter
155-
fig.legend(spec=spec_io, position="jMC+w9c", box="+p1p,gray50+ggray95")
156+
fig.legend(spec=spec_io, position="jMC+w9c", box=Box(pen="1p,gray50", fill="gray95"))
156157

157158
fig.show()
158159

0 commit comments

Comments
 (0)