@@ -153,3 +153,63 @@ def test_colorbar_scaled_z_values():
153
153
fig = Figure ()
154
154
fig .colorbar (cmap = "rainbow" , scale = 0.1 , position = "x0c/0c+w2c/0.5c" )
155
155
return fig
156
+
157
+
158
+ @check_figures_equal ()
159
+ def test_colorbar_shading_boolean ():
160
+ """
161
+ Create colorbar and set shading with a Boolean value
162
+ """
163
+ fig_ref , fig_test = Figure (), Figure ()
164
+ # Use single-character arguments for the reference image
165
+ fig_ref .basemap (R = "0/10/0/10" , J = "X15c" , B = "a" )
166
+ fig_ref .colorbar (C = "geo" , I = "" )
167
+
168
+ fig_test .basemap (region = [0 , 10 , 0 , 10 ], projection = "X15c" , frame = "a" )
169
+ fig_test .colorbar (cmap = "geo" , shading = True )
170
+ return fig_ref , fig_test
171
+
172
+
173
+ @check_figures_equal ()
174
+ def test_colorbar_shading_float ():
175
+ """
176
+ Create colorbar and set shading with a single float variable
177
+ """
178
+ fig_ref , fig_test = Figure (), Figure ()
179
+ # Use single-character arguments for the reference image
180
+ fig_ref .basemap (R = "0/10/0/10" , J = "X15c" , B = "a" )
181
+ fig_ref .colorbar (C = "geo" , I = 0.5 )
182
+
183
+ fig_test .basemap (region = [0 , 10 , 0 , 10 ], projection = "X15c" , frame = "a" )
184
+ fig_test .colorbar (cmap = "geo" , shading = 0.5 )
185
+ return fig_ref , fig_test
186
+
187
+
188
+ @check_figures_equal ()
189
+ def test_colorbar_shading_string ():
190
+ """
191
+ Create colorbar and set shading by passing the low/high values as a string
192
+ """
193
+ fig_ref , fig_test = Figure (), Figure ()
194
+ # Use single-character arguments for the reference image
195
+ fig_ref .basemap (R = "0/10/0/10" , J = "X15c" , B = "a" )
196
+ fig_ref .colorbar (C = "geo" , I = "-0.7/0.2" )
197
+
198
+ fig_test .basemap (region = [0 , 10 , 0 , 10 ], projection = "X15c" , frame = "a" )
199
+ fig_test .colorbar (cmap = "geo" , shading = "-0.7/0.2" )
200
+ return fig_ref , fig_test
201
+
202
+
203
+ @check_figures_equal ()
204
+ def test_colorbar_shading_list ():
205
+ """
206
+ Create colorbar and set shading by passing the high/low values as a list
207
+ """
208
+ fig_ref , fig_test = Figure (), Figure ()
209
+ # Use single-character arguments for the reference image
210
+ fig_ref .basemap (R = "0/10/0/10" , J = "X15c" , B = "a" )
211
+ fig_ref .colorbar (C = "geo" , I = "-0.7/0.2" )
212
+
213
+ fig_test .basemap (region = [0 , 10 , 0 , 10 ], projection = "X15c" , frame = "a" )
214
+ fig_test .colorbar (cmap = "geo" , shading = [- 0.7 , 0.2 ])
215
+ return fig_ref , fig_test
0 commit comments