Skip to content

Commit 15cf815

Browse files
authored
Migrate frame settings to the Frame/Axis class [frame="+t" or similar] (#4535)
1 parent 0bb6ba6 commit 15cf815

7 files changed

Lines changed: 27 additions & 12 deletions

File tree

examples/gallery/lines/decorated_lines.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
# %%
1919
import numpy as np
2020
import pygmt
21+
from pygmt.params import Frame
2122

2223
# Generate a two-point line for plotting
2324
x = np.array([1, 4])
2425
y = np.array([24, 24])
2526

2627
fig = pygmt.Figure()
27-
fig.basemap(region=[0, 10, 0, 24], projection="X15c", frame="+tDecorated Lines")
28+
fig.basemap(
29+
region=[0, 10, 0, 24], projection="X15c", frame=Frame(title="Decorated Lines")
30+
)
2831

2932
# Plot different decorated lines
3033
for decoline in [

examples/gallery/lines/linefronts.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@
3535
# %%
3636
import numpy as np
3737
import pygmt
38+
from pygmt.params import Frame
3839

3940
# Generate a two-point line for plotting
4041
x = np.array([1, 4])
4142
y = np.array([20, 20])
4243

4344
fig = pygmt.Figure()
44-
fig.basemap(region=[0, 10, 0, 20], projection="X15c/15c", frame="+tLine Fronts")
45+
fig.basemap(
46+
region=[0, 10, 0, 20], projection="X15c/15c", frame=Frame(title="Line Fronts")
47+
)
4548

4649
# Plot the line using different front styles
4750
for frontstyle in [

examples/gallery/lines/linestyles.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@
2020
# %%
2121
import numpy as np
2222
import pygmt
23+
from pygmt.params import Frame
2324

2425
# Generate a two-point line for plotting
2526
x = np.array([0, 7])
2627
y = np.array([9, 9])
2728

2829
fig = pygmt.Figure()
29-
fig.basemap(region=[0, 10, 0, 10], projection="X15c/8c", frame="+tLine Styles")
30+
fig.basemap(
31+
region=[0, 10, 0, 10], projection="X15c/8c", frame=Frame(title="Line Styles")
32+
)
3033

3134
# Plot the line using the default line style
3235
fig.plot(x=x, y=y)

examples/gallery/lines/quoted_lines.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
# %%
1818
import numpy as np
1919
import pygmt
20+
from pygmt.params import Frame
2021

2122
# Generate a two-point line for plotting
2223
x = np.array([1, 4])
2324
y = np.array([20, 20])
2425

2526
fig = pygmt.Figure()
26-
fig.basemap(region=[0, 10, 0, 20], projection="X15c/15c", frame="+tQuoted Lines")
27+
fig.basemap(
28+
region=[0, 10, 0, 20], projection="X15c/15c", frame=Frame(title="Quoted Lines")
29+
)
2730

2831
# Plot different quoted lines
2932
for quotedline in [

examples/gallery/lines/vector_heads_tails.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131

3232
# %%
3333
import pygmt
34+
from pygmt.params import Frame
3435

3536
fig = pygmt.Figure()
3637
fig.basemap(
37-
region=[0, 10, 0, 15], projection="X15c/10c", frame="+tVector heads and tails"
38+
region=[0, 10, 0, 15],
39+
projection="X15c/10c",
40+
frame=Frame(title="Vector heads and tails"),
3841
)
3942

4043
x = 1

examples/gallery/symbols/bars.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# %%
2323
import pygmt
24-
from pygmt.params import Axis
24+
from pygmt.params import Axis, Frame
2525

2626
fig = pygmt.Figure()
2727

@@ -39,15 +39,15 @@
3939
pen = "1.5p"
4040
with fig.set_panel(panel=0):
4141
fill = "skyblue"
42-
fig.basemap(region=[0, 4, 0, 3], frame="+tvertical bars")
42+
fig.basemap(region=[0, 4, 0, 3], frame=Frame(title="vertical bars"))
4343
fig.plot(x=1, y=2, style="b0.5c", fill=fill, pen=pen)
4444
fig.plot(x=2, y=2.5, style="b1c", fill=fill, pen=pen)
4545
# +b1 means that the bar is starting from y=1 here
4646
fig.plot(x=3, y=2.5, style="b0.75c+b1", fill=fill, pen=pen)
4747

4848
with fig.set_panel(panel=1):
4949
fill = "tomato"
50-
fig.basemap(region=[0, 4, 0, 3], frame="+thorizontal bars")
50+
fig.basemap(region=[0, 4, 0, 3], frame=Frame(title="horizontal bars"))
5151
fig.plot(x=1.5, y=0.5, style="B0.75c", fill=fill, pen=pen)
5252
fig.plot(x=3, y=1.5, style="B1c", fill=fill, pen=pen)
5353
# +b2 means that the bar is starting from x=2 here
@@ -63,11 +63,11 @@
6363
}
6464

6565
with fig.set_panel(panel=2):
66-
fig.basemap(region=[0, 4, 0, 3], frame="+tstacked bars")
66+
fig.basemap(region=[0, 4, 0, 3], frame=Frame(title="stacked bars"))
6767
fig.plot(data=data, style="B0.75c+i4", cmap=True, pen=pen)
6868

6969
with fig.set_panel(panel=3):
70-
fig.basemap(region=[0, 4, 0, 3], frame="+tsplit bars")
70+
fig.basemap(region=[0, 4, 0, 3], frame=Frame(title="split bars"))
7171
fig.plot(data=data, style="B1c+v4+s", cmap=True, pen=pen)
7272

7373
fig.show()

pygmt/tests/test_subplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def test_subplot_basic_frame():
1919

2020
with fig.subplot(nrows=1, ncols=2, figsize=("6c", "3c"), frame=Frame(axes="WSne")):
2121
with fig.set_panel(panel="0,0"):
22-
fig.basemap(region=[0, 3, 0, 3], frame="+tplot0")
22+
fig.basemap(region=[0, 3, 0, 3], frame=Frame(title="plot0"))
2323
with fig.set_panel(panel=[0, 1]):
24-
fig.basemap(region=[0, 3, 0, 3], frame="+tplot1")
24+
fig.basemap(region=[0, 3, 0, 3], frame=Frame(title="plot1"))
2525
return fig
2626

2727

0 commit comments

Comments
 (0)