Skip to content

Commit 4c6a97c

Browse files
DOC/Gallery example "Double Y-axes graph": Migrate frame settings to the new Frame/Axis syntax (#4503)
1 parent 9375c02 commit 4c6a97c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

examples/gallery/basemaps/double_y_axes.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class can control which axes should be plotted and optionally show annotations,
2020
# %%
2121
import numpy as np
2222
import pygmt
23-
from pygmt.params import Position
23+
from pygmt.params import Axis, Frame, Position
2424

2525
# Generate two sample Y-data from one common X-data
2626
x = np.linspace(1.0, 9.0, num=9)
@@ -33,7 +33,11 @@ class can control which axes should be plotted and optionally show annotations,
3333
# The bottom axis (S) is plotted with annotations and tick marks
3434
# The top axis (t) is plotted without annotations and tick marks
3535
# The left and right axes are not drawn
36-
fig.basemap(region=[0, 10, 0, 10], projection="X15c/15c", frame=["St", "xaf+lx"])
36+
fig.basemap(
37+
region=[0, 10, 0, 10],
38+
projection="X15c/15c",
39+
frame=Frame(axes="St", xaxis=Axis(annot=True, tick=True, label="x")),
40+
)
3741

3842
# Plot the Y-axis for y1-data
3943
# The left axis (W) is plotted with blue annotations, ticks, and label
@@ -43,7 +47,7 @@ class can control which axes should be plotted and optionally show annotations,
4347
FONT_ANNOT_PRIMARY="blue",
4448
FONT_LABEL="blue",
4549
):
46-
fig.basemap(frame=["W", "yaf+ly1"])
50+
fig.basemap(frame=Frame(axes="W", yaxis=Axis(annot=True, tick=True, label="y1")))
4751

4852
# Plot the line for y1-data
4953
fig.plot(x=x, y=y1, pen="1p,blue")
@@ -58,7 +62,10 @@ class can control which axes should be plotted and optionally show annotations,
5862
FONT_ANNOT_PRIMARY="red",
5963
FONT_LABEL="red",
6064
):
61-
fig.basemap(region=[0, 10, 100, 200], frame=["E", "yaf+ly2"])
65+
fig.basemap(
66+
region=[0, 10, 100, 200],
67+
frame=Frame(axes="E", yaxis=Axis(annot=True, tick=True, label="y2")),
68+
)
6269
# Plot the line for y2-data
6370
fig.plot(x=x, y=y2, pen="1p,red")
6471
# Plot points for y2-data

0 commit comments

Comments
 (0)