1212from pygmt import Figure , which
1313from pygmt .exceptions import GMTInvalidInput , GMTParameterError , GMTTypeError
1414from pygmt .helpers import GMTTempFile
15+ from pygmt .params import Axis , Frame
1516
1617POINTS_DATA = Path (__file__ ).parent / "data" / "points.txt"
1718
@@ -45,7 +46,7 @@ def test_plot_red_circles(data, region):
4546 projection = "X10c" ,
4647 style = "c0.2c" ,
4748 fill = "red" ,
48- frame = "afg" ,
49+ frame = Axis ( annot = True , tick = True , grid = True ) ,
4950 )
5051 return fig
5152
@@ -57,7 +58,11 @@ def test_plot_fail_no_data(data, region):
5758 fig = Figure ()
5859 with pytest .raises (GMTInvalidInput ):
5960 fig .plot (
60- region = region , projection = "X10c" , style = "c0.2c" , fill = "red" , frame = "afg"
61+ region = region ,
62+ projection = "X10c" ,
63+ style = "c0.2c" ,
64+ fill = "red" ,
65+ frame = Axis (annot = True , tick = True , grid = True ),
6166 )
6267 with pytest .raises (GMTInvalidInput ):
6368 fig .plot (
@@ -66,7 +71,7 @@ def test_plot_fail_no_data(data, region):
6671 projection = "X10c" ,
6772 style = "c0.2c" ,
6873 fill = "red" ,
69- frame = "afg" ,
74+ frame = Axis ( annot = True , tick = True , grid = True ) ,
7075 )
7176 with pytest .raises (GMTInvalidInput ):
7277 fig .plot (
@@ -75,7 +80,7 @@ def test_plot_fail_no_data(data, region):
7580 projection = "X10c" ,
7681 style = "c0.2c" ,
7782 fill = "red" ,
78- frame = "afg" ,
83+ frame = Axis ( annot = True , tick = True , grid = True ) ,
7984 )
8085 # Should also fail if given too much data
8186 with pytest .raises (GMTParameterError ):
@@ -87,7 +92,7 @@ def test_plot_fail_no_data(data, region):
8792 projection = "X10c" ,
8893 style = "c0.2c" ,
8994 fill = "red" ,
90- frame = "afg" ,
95+ frame = Axis ( annot = True , tick = True , grid = True ) ,
9196 )
9297
9398
@@ -97,7 +102,12 @@ def test_plot_fail_1d_array_with_data(data, region):
97102 symbol are specified when data is given.
98103 """
99104 fig = Figure ()
100- kwargs = {"data" : data , "region" : region , "projection" : "X10c" , "frame" : "afg" }
105+ kwargs = {
106+ "data" : data ,
107+ "region" : region ,
108+ "projection" : "X10c" ,
109+ "frame" : Frame (axis = Axis (annot = True , tick = True , grid = True )),
110+ }
101111 with pytest .raises (GMTTypeError ):
102112 fig .plot (style = "c0.2c" , fill = data [:, 2 ], ** kwargs )
103113 with pytest .raises (GMTTypeError ):
@@ -123,7 +133,7 @@ def test_plot_projection(data):
123133 projection = "R270/10c" ,
124134 style = "s0.2c" ,
125135 fill = "green" ,
126- frame = "ag" ,
136+ frame = Axis ( annot = True , grid = True ) ,
127137 )
128138 return fig
129139
@@ -142,7 +152,7 @@ def test_plot_colors(data, region):
142152 projection = "X10c" ,
143153 style = "c0.5c" ,
144154 cmap = "cpt-city/cubhelix" ,
145- frame = "af" ,
155+ frame = Axis ( annot = True , tick = True ) ,
146156 )
147157 return fig
148158
@@ -161,7 +171,7 @@ def test_plot_sizes(data, region):
161171 projection = "X10c" ,
162172 style = "cc" ,
163173 fill = "blue" ,
164- frame = "af" ,
174+ frame = Axis ( annot = True , tick = True ) ,
165175 )
166176 return fig
167177
@@ -181,7 +191,7 @@ def test_plot_colors_sizes(data, region):
181191 projection = "X10c" ,
182192 style = "cc" ,
183193 cmap = "matlab/copper" ,
184- frame = "af" ,
194+ frame = Axis ( annot = True , tick = True ) ,
185195 )
186196 return fig
187197
@@ -192,7 +202,12 @@ def test_plot_colors_sizes_proj(data, region):
192202 Plot the data using z as sizes and fills with a projection.
193203 """
194204 fig = Figure ()
195- fig .coast (region = region , projection = "M15c" , frame = "af" , water = "skyblue" )
205+ fig .coast (
206+ region = region ,
207+ projection = "M15c" ,
208+ frame = Axis (annot = True , tick = True ),
209+ water = "skyblue" ,
210+ )
196211 fig .plot (
197212 x = data [:, 0 ],
198213 y = data [:, 1 ],
@@ -219,7 +234,7 @@ def test_plot_varying_intensity():
219234 y = y ,
220235 region = [- 1.1 , 1.1 , - 0.5 , 0.5 ],
221236 projection = "X10c/2c" ,
222- frame = [ "S" , "xaf+lIntensity" ] ,
237+ frame = Frame ( axes = "S" , xaxis = Axis ( annot = True , tick = True , label = "Intensity" )) ,
223238 style = "c0.25c" ,
224239 fill = "blue" ,
225240 intensity = intensity ,
@@ -313,7 +328,7 @@ def test_plot_symbol():
313328 fill = "blue" ,
314329 size = [0.1 , 0.2 , 0.3 , 0.4 ],
315330 symbol = ["c" , "t" , "i" , "s" ],
316- frame = "af" ,
331+ frame = Axis ( annot = True , tick = True ) ,
317332 )
318333 return fig
319334
@@ -331,7 +346,7 @@ def test_plot_matrix(data, fill):
331346 projection = "M15c" ,
332347 style = "cc" ,
333348 fill = fill ,
334- frame = "a" ,
349+ frame = Axis ( annot = True ) ,
335350 incols = "0,1,2+s0.5" ,
336351 )
337352 return fig
@@ -349,7 +364,7 @@ def test_plot_matrix_color(data):
349364 projection = "X10c" ,
350365 style = "c0.5c" ,
351366 cmap = "gmt/rainbow" ,
352- frame = "a" ,
367+ frame = Axis ( annot = True ) ,
353368 )
354369 return fig
355370
@@ -391,7 +406,7 @@ def test_plot_vectors():
391406 projection = "X10c" ,
392407 style = "V0.2c+e+n" ,
393408 fill = "black" ,
394- frame = "af" ,
409+ frame = Axis ( annot = True , tick = True ) ,
395410 )
396411 return fig
397412
@@ -488,7 +503,11 @@ def test_plot_timedelta64():
488503 fig .basemap (
489504 projection = "X8c/5c" ,
490505 region = [tmin , tmax , 0 , 10 ],
491- frame = ["WSne" , "xaf+lForecast Days" , "yaf+lRMSE" ],
506+ frame = Frame (
507+ axes = "WSne" ,
508+ xaxis = Axis (annot = True , tick = True , label = "Forecast Days" ),
509+ yaxis = Axis (annot = True , tick = True , label = "RMSE" ),
510+ ),
492511 )
493512 fig .plot (
494513 x = np .arange (tmin , tmax ),
0 commit comments