File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -5576,6 +5576,15 @@ def _interp_grid(X):
5576
5576
# helper for below
5577
5577
if np .shape (X )[1 ] > 1 :
5578
5578
dX = np .diff (X , axis = 1 )/ 2.
5579
+ if not (np .all (dX >= 0 ) or np .all (dX <= 0 )):
5580
+ cbook ._warn_external (
5581
+ f"The input coordinates to { funcname } are "
5582
+ "not all either increasing or decreasing, "
5583
+ "the automatically computed edges can "
5584
+ "produce misleading results in this case. "
5585
+ "It is recommended to supply the "
5586
+ f"quadrilateral edges to { funcname } "
5587
+ f" yourself. See help({ funcname } )." )
5579
5588
X = np .hstack ((X [:, [0 ]] - dX [:, [0 ]],
5580
5589
X [:, :- 1 ] + dX ,
5581
5590
X [:, [- 1 ]] + dX [:, [- 1 ]]))
Original file line number Diff line number Diff line change @@ -1175,6 +1175,13 @@ def test_pcolorargs():
1175
1175
x = np .ma .array (x , mask = (x < 0 ))
1176
1176
with pytest .raises (ValueError ):
1177
1177
ax .pcolormesh (x , y , Z [:- 1 , :- 1 ])
1178
+ # Expect a warning with non-increasing coordinates
1179
+ x = [359 , 0 , 1 ]
1180
+ y = [- 10 , 10 ]
1181
+ X , Y = np .meshgrid (x , y )
1182
+ Z = np .zeros (X .shape )
1183
+ with pytest .warns (UserWarning , match = "The input coordinates" ):
1184
+ ax .pcolormesh (X , Y , Z , shading = 'auto' )
1178
1185
1179
1186
1180
1187
@check_figures_equal (extensions = ["png" ])
You can’t perform that action at this time.
0 commit comments