@@ -93,15 +93,15 @@ def test_plot_fail_no_data(data):
93
93
94
94
def test_plot_fail_color_size_intensity (data ):
95
95
"""
96
- Should raise an exception if array color, sizes and intensity are used with
96
+ Should raise an exception if array color, size and intensity are used with
97
97
matrix.
98
98
"""
99
99
fig = Figure ()
100
100
kwargs = dict (data = data , region = region , projection = "X10c" , frame = "afg" )
101
101
with pytest .raises (GMTInvalidInput ):
102
102
fig .plot (style = "c0.2c" , color = data [:, 2 ], ** kwargs )
103
103
with pytest .raises (GMTInvalidInput ):
104
- fig .plot (style = "cc" , sizes = data [:, 2 ], color = "red" , ** kwargs )
104
+ fig .plot (style = "cc" , size = data [:, 2 ], color = "red" , ** kwargs )
105
105
with pytest .raises (GMTInvalidInput ):
106
106
fig .plot (style = "c0.2c" , color = "red" , intensity = data [:, 2 ], ** kwargs )
107
107
@@ -152,7 +152,7 @@ def test_plot_sizes(data, region):
152
152
fig .plot (
153
153
x = data [:, 0 ],
154
154
y = data [:, 1 ],
155
- sizes = 0.5 * data [:, 2 ],
155
+ size = 0.5 * data [:, 2 ],
156
156
region = region ,
157
157
projection = "X10c" ,
158
158
style = "cc" ,
@@ -172,7 +172,7 @@ def test_plot_colors_sizes(data, region):
172
172
x = data [:, 0 ],
173
173
y = data [:, 1 ],
174
174
color = data [:, 2 ],
175
- sizes = 0.5 * data [:, 2 ],
175
+ size = 0.5 * data [:, 2 ],
176
176
region = region ,
177
177
projection = "X10c" ,
178
178
style = "cc" ,
@@ -193,7 +193,7 @@ def test_plot_colors_sizes_proj(data, region):
193
193
x = data [:, 0 ],
194
194
y = data [:, 1 ],
195
195
color = data [:, 2 ],
196
- sizes = 0.5 * data [:, 2 ],
196
+ size = 0.5 * data [:, 2 ],
197
197
style = "cc" ,
198
198
cmap = "copper" ,
199
199
)
@@ -288,7 +288,7 @@ def test_plot_sizes_colors_transparencies():
288
288
frame = True ,
289
289
style = "cc" ,
290
290
color = color ,
291
- sizes = size ,
291
+ size = size ,
292
292
cmap = "gray" ,
293
293
transparency = transparency ,
294
294
)
@@ -446,3 +446,27 @@ def test_plot_datetime():
446
446
y = [8.5 , 9.5 ]
447
447
fig .plot (x , y , style = "i0.2c" , pen = "1p" )
448
448
return fig
449
+
450
+
451
+ @pytest .mark .mpl_image_compare (filename = "test_plot_sizes.png" )
452
+ def test_plot_deprecate_sizes_to_size (data , region ):
453
+ """
454
+ Make sure that the old parameter "sizes" is supported and it reports an
455
+ warning.
456
+
457
+ Modified from the test_plot_sizes() test.
458
+ """
459
+ fig = Figure ()
460
+ with pytest .warns (expected_warning = FutureWarning ) as record :
461
+ fig .plot (
462
+ x = data [:, 0 ],
463
+ y = data [:, 1 ],
464
+ sizes = 0.5 * data [:, 2 ],
465
+ region = region ,
466
+ projection = "X10c" ,
467
+ style = "cc" ,
468
+ color = "blue" ,
469
+ frame = "af" ,
470
+ )
471
+ assert len (record ) == 1 # check that only one warning was raised
472
+ return fig
0 commit comments