Skip to content

Commit 9a334ce

Browse files
authored
Figure.plot: Update parameter 'color' to 'fill' in test_plot.py (#2189)
1 parent 9b1e7f1 commit 9a334ce

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

pygmt/tests/test_plot.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_plot_red_circles(data, region):
4646
region=region,
4747
projection="X10c",
4848
style="c0.2c",
49-
color="red",
49+
fill="red",
5050
frame="afg",
5151
)
5252
return fig
@@ -59,15 +59,15 @@ def test_plot_fail_no_data(data, region):
5959
fig = Figure()
6060
with pytest.raises(GMTInvalidInput):
6161
fig.plot(
62-
region=region, projection="X10c", style="c0.2c", color="red", frame="afg"
62+
region=region, projection="X10c", style="c0.2c", fill="red", frame="afg"
6363
)
6464
with pytest.raises(GMTInvalidInput):
6565
fig.plot(
6666
x=data[:, 0],
6767
region=region,
6868
projection="X10c",
6969
style="c0.2c",
70-
color="red",
70+
fill="red",
7171
frame="afg",
7272
)
7373
with pytest.raises(GMTInvalidInput):
@@ -76,7 +76,7 @@ def test_plot_fail_no_data(data, region):
7676
region=region,
7777
projection="X10c",
7878
style="c0.2c",
79-
color="red",
79+
fill="red",
8080
frame="afg",
8181
)
8282
# Should also fail if given too much data
@@ -88,26 +88,26 @@ def test_plot_fail_no_data(data, region):
8888
region=region,
8989
projection="X10c",
9090
style="c0.2c",
91-
color="red",
91+
fill="red",
9292
frame="afg",
9393
)
9494

9595

9696
def test_plot_fail_1d_array_with_data(data, region):
9797
"""
98-
Should raise an exception if array color, size, intensity and transparency
98+
Should raise an exception if array fill, size, intensity and transparency
9999
are used with matrix.
100100
"""
101101
fig = Figure()
102102
kwargs = dict(data=data, region=region, projection="X10c", frame="afg")
103103
with pytest.raises(GMTInvalidInput):
104-
fig.plot(style="c0.2c", color=data[:, 2], **kwargs)
104+
fig.plot(style="c0.2c", fill=data[:, 2], **kwargs)
105105
with pytest.raises(GMTInvalidInput):
106-
fig.plot(style="cc", size=data[:, 2], color="red", **kwargs)
106+
fig.plot(style="cc", size=data[:, 2], fill="red", **kwargs)
107107
with pytest.raises(GMTInvalidInput):
108-
fig.plot(style="c0.2c", color="red", intensity=data[:, 2], **kwargs)
108+
fig.plot(style="c0.2c", fill="red", intensity=data[:, 2], **kwargs)
109109
with pytest.raises(GMTInvalidInput):
110-
fig.plot(style="c0.2c", color="red", transparency=data[:, 2] * 100, **kwargs)
110+
fig.plot(style="c0.2c", fill="red", transparency=data[:, 2] * 100, **kwargs)
111111

112112

113113
@pytest.mark.mpl_image_compare
@@ -122,7 +122,7 @@ def test_plot_projection(data):
122122
region="g",
123123
projection="R270/10c",
124124
style="s0.2c",
125-
color="green",
125+
fill="green",
126126
frame="ag",
127127
)
128128
return fig
@@ -131,13 +131,13 @@ def test_plot_projection(data):
131131
@pytest.mark.mpl_image_compare
132132
def test_plot_colors(data, region):
133133
"""
134-
Plot the data using z as colors.
134+
Plot the data using z as fills.
135135
"""
136136
fig = Figure()
137137
fig.plot(
138138
x=data[:, 0],
139139
y=data[:, 1],
140-
color=data[:, 2],
140+
fill=data[:, 2],
141141
region=region,
142142
projection="X10c",
143143
style="c0.5c",
@@ -160,7 +160,7 @@ def test_plot_sizes(data, region):
160160
region=region,
161161
projection="X10c",
162162
style="cc",
163-
color="blue",
163+
fill="blue",
164164
frame="af",
165165
)
166166
return fig
@@ -169,13 +169,13 @@ def test_plot_sizes(data, region):
169169
@pytest.mark.mpl_image_compare
170170
def test_plot_colors_sizes(data, region):
171171
"""
172-
Plot the data using z as sizes and colors.
172+
Plot the data using z as sizes and fills.
173173
"""
174174
fig = Figure()
175175
fig.plot(
176176
x=data[:, 0],
177177
y=data[:, 1],
178-
color=data[:, 2],
178+
fill=data[:, 2],
179179
size=0.5 * data[:, 2],
180180
region=region,
181181
projection="X10c",
@@ -189,14 +189,14 @@ def test_plot_colors_sizes(data, region):
189189
@pytest.mark.mpl_image_compare
190190
def test_plot_colors_sizes_proj(data, region):
191191
"""
192-
Plot the data using z as sizes and colors with a projection.
192+
Plot the data using z as sizes and fills with a projection.
193193
"""
194194
fig = Figure()
195195
fig.coast(region=region, projection="M15c", frame="af", water="skyblue")
196196
fig.plot(
197197
x=data[:, 0],
198198
y=data[:, 1],
199-
color=data[:, 2],
199+
fill=data[:, 2],
200200
size=0.5 * data[:, 2],
201201
style="cc",
202202
cmap="copper",
@@ -221,7 +221,7 @@ def test_plot_varying_intensity():
221221
projection="X10c/2c",
222222
frame=["S", "xaf+lIntensity"],
223223
style="c0.25c",
224-
color="blue",
224+
fill="blue",
225225
intensity=intensity,
226226
)
227227
return fig
@@ -243,7 +243,7 @@ def test_plot_transparency():
243243
projection="X10c",
244244
frame=True,
245245
style="c0.2c",
246-
color="blue",
246+
fill="blue",
247247
transparency=80.0,
248248
)
249249
return fig
@@ -266,7 +266,7 @@ def test_plot_varying_transparency():
266266
projection="X10c",
267267
frame=True,
268268
style="c0.2c",
269-
color="blue",
269+
fill="blue",
270270
transparency=z,
271271
)
272272
return fig
@@ -275,11 +275,11 @@ def test_plot_varying_transparency():
275275
@pytest.mark.mpl_image_compare
276276
def test_plot_sizes_colors_transparencies():
277277
"""
278-
Plot the data with varying sizes and colors using z as transparency.
278+
Plot the data with varying sizes and fills using z as transparency.
279279
"""
280280
x = np.arange(1.0, 10.0)
281281
y = np.arange(1.0, 10.0)
282-
color = np.arange(1, 10) * 0.15
282+
fill = np.arange(1, 10) * 0.15
283283
size = np.arange(1, 10) * 0.2
284284
transparency = np.arange(1, 10) * 10
285285

@@ -291,7 +291,7 @@ def test_plot_sizes_colors_transparencies():
291291
projection="X10c",
292292
frame=True,
293293
style="cc",
294-
color=color,
294+
fill=fill,
295295
size=size,
296296
cmap="gray",
297297
transparency=transparency,
@@ -300,8 +300,8 @@ def test_plot_sizes_colors_transparencies():
300300

301301

302302
@pytest.mark.mpl_image_compare(filename="test_plot_matrix.png")
303-
@pytest.mark.parametrize("color", ["#aaaaaa", 170])
304-
def test_plot_matrix(data, color):
303+
@pytest.mark.parametrize("fill", ["#aaaaaa", 170])
304+
def test_plot_matrix(data, fill):
305305
"""
306306
Plot the data passing in a matrix and specifying columns.
307307
"""
@@ -311,7 +311,7 @@ def test_plot_matrix(data, color):
311311
region=[10, 70, -5, 10],
312312
projection="M15c",
313313
style="cc",
314-
color=color,
314+
fill=fill,
315315
frame="a",
316316
incols="0,1,2+s0.5",
317317
)
@@ -346,7 +346,7 @@ def test_plot_from_file(region):
346346
region=region,
347347
projection="X10c",
348348
style="d1c",
349-
color="yellow",
349+
fill="yellow",
350350
frame=True,
351351
incols=[0, 1],
352352
)
@@ -370,7 +370,7 @@ def test_plot_vectors():
370370
region="-2/2/-2/2",
371371
projection="X10c",
372372
style="V0.2c+e+n",
373-
color="black",
373+
fill="black",
374374
frame="af",
375375
)
376376
return fig

0 commit comments

Comments
 (0)